diff --git a/src/AutoRest.CSharp/Properties/launchSettings.json b/src/AutoRest.CSharp/Properties/launchSettings.json index 9b6964c524e..b5db628cff3 100644 --- a/src/AutoRest.CSharp/Properties/launchSettings.json +++ b/src/AutoRest.CSharp/Properties/launchSettings.json @@ -520,10 +520,6 @@ "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\OldestVersion-TypeSpec\\src\\Generated -n" }, - "Pagination-TypeSpec": { - "commandName": "Project", - "commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\Pagination-TypeSpec\\src\\Generated -n" - }, "PaginationParams-LowLevel": { "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\PaginationParams-LowLevel\\src\\Generated -n" diff --git a/test/TestProjects/Pagination-TypeSpec/Configuration.json b/test/TestProjects/Pagination-TypeSpec/Configuration.json deleted file mode 100644 index dc4d164b6fc..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/Configuration.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "output-folder": ".", - "namespace": "Pagination", - "library-name": "Pagination", - "flavor": "azure", - "use-model-reader-writer": true, - "shared-source-folders": [ - "../../../../../artifacts/bin/AutoRest.CSharp/Debug/net8.0/Generator.Shared", - "../../../../../artifacts/bin/AutoRest.CSharp/Debug/net8.0/Azure.Core.Shared" - ] -} diff --git a/test/TestProjects/Pagination-TypeSpec/Pagination-TypeSpec.tsp b/test/TestProjects/Pagination-TypeSpec/Pagination-TypeSpec.tsp deleted file mode 100644 index 9a8ec99cad4..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/Pagination-TypeSpec.tsp +++ /dev/null @@ -1,413 +0,0 @@ -import "@typespec/rest"; -import "@typespec/http"; -import "@typespec/versioning"; -import "@azure-tools/typespec-client-generator-core"; -import "@azure-tools/typespec-azure-core"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.Core; -using Azure.Core.Traits; -using Azure.ClientGenerator.Core; - -// -// ** Service description ** -// - -// TODO: Use `Uri` type when available: https://github.com/microsoft/cadl/issues/654 -@versioned(Versions) -@service( - { - title: "Pagination Service" - } -) -@server( - "{pagnationUri}", - "Pagination Service", - { - pagnationUri: string, - } -) -@useAuth(OAuth2Auth<[AuthFlow]>) -namespace Pagination; - -enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_1) - "2022-05-13" -} - -model AuthFlow { - type: OAuth2FlowType.clientCredentials; - tokenUrl: "https://pagnation.azure.com/token"; - refreshUrl: "https://pagination.azure.com/refresh"; - scopes: [ - "https://pagination.azure.com/.default" - ] -} - -// -// ** Parameter descriptions ** -// - -// @doc("A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.") -// model TransactionId is string; - -// model CollectionIdParameter { -// @query -// @doc("The collection id.") -// collectionId?: string; -// } - -// -// ** Model descriptions ** -// - -// @resource("collections") -// @doc("Identifier for collections.") -// model Collection { -// @key -// collectionId: string; -// } - -@resource("transactions") -model LedgerEntry { - @doc("Contents of the ledger entry.") - contents: string; - - @visibility("read") - collectionId: string; - - @key - @visibility("read") - // @doc("A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.") - transactionId: string; -} - -@doc("Paginated ledger entries") -@pagedResult -model PagedLedgerEntries { - @doc("Array of ledger entries") - @items - entries: LedgerEntry[]; - - @doc("Path to retrieve next page of ledger entries") - @nextLink - customNextLink?: ResourceLocation; -} - -@doc("List {name} resources", TResource) -op CustomResourceList< - TResource extends object, - TCustom extends Foundations.CustomizationFields = {} -> is Foundations.ResourceList< - TResource, - Foundations.CustomParameters, - Page ->; - -// // TODO: No way to set "x-ms-enum.name" right now -// @doc("Represents an assignable role.") -// @knownValues(LedgerUserRoleKV) -// model LedgerUserRole is string {}; - -@doc("User roles") -union LedgerUserRoleKV { - string, - Administrator: "Administrator", - Contributor: "Contributor", - Reader: "Reader", -} - -// @resource("users") -// @doc("Details about a Confidential ledger user.") -// model LedgerUser { -// @key -// @doc("The user id, either an AAD object ID or certificate fingerprint.") -// @extension("x-ms-skip-url-encoding", true) -// userId: string; - -// @doc("The user's assigned role.") -// assignedRole: LedgerUserRole; -// } - -// model ReceiptContents { -// // Elided for now -// } - -// // TODO: No way to set "x-ms-enum.name" right now -// @doc("State of a ledger query.") -// @knownValues(LedgerQueryStateKV) -// model LedgerQueryState is string {}; - -// enum LedgerQueryStateKV { -// Loading, -// Ready, -// } - -// @doc("A receipt certifying the transaction at the specified id.") -// model TransactionReceipt { -// receipt: ReceiptContents; -// state: LedgerQueryState; -// transactionId: string; -// } - -// // TODO: No way to set "x-ms-enum.name" right now -// @doc("Represents the state of the transaction.") -// @knownValues(TransactionStateKV) -// model TransactionState is string {}; - -// enum TransactionStateKV { -// Committed, -// Pending, -// } - -// @doc("Response returned to a query for the transaction status.") -// model TransactionStatus { -// state: TransactionState; -// transactionId: string; -// } - - -@doc("Type for input model body") -model ListLedgerEntryInputBody { - @doc("Required string") - requiredString: string; - - @doc("Required int") - requiredInt: int32; -} - -@doc("Input model for the ListPaginationLedgerEntries") -model ListLedgerEntryInput { - @doc("Body parameter") - @body bodyInput: ListLedgerEntryInputBody; -} - -@doc("Text Blocklist.") -@resource("text/blocklists") -model TextBlocklist { - @doc("Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~") - @key("blocklistName") - @visibility("read", "create", "query") - @maxLength(64) - blocklistName: string; - - @doc("Text blocklist description.") - @maxLength(1024) - description?: string; -} - -@doc("Item in TextBlocklist.") -@resource("blockItems") -@parentResource(TextBlocklist) -model TextBlockItem { - @doc("Block Item Id. It will be uuid.") - @key("blockItemId") - @visibility("read", "create", "query") - @maxLength(64) - blockItemId: string; - - @doc("Block item description.") - @maxLength(1024) - description?: string; - - @doc("Block item content.") - @maxLength(128) - text: string; -} - -@doc("The interval") -union Interval { - string, - @doc("5 seconds, available only if test run duration is less than 10 minutes") - PT5S: "PT5S", - @doc("10 seconds, available only if test run duration is less than 10 minutes") - PT10S: "PT10S", - @doc("1 minute") PT1M: "PT1M", - @doc("5 minutes, available only if test run duration is greater than 1 minute") - PT5M: "PT5M", - @doc("1 hour, available only if test run duration is greater than 1 minute") - PT1H: "PT1H", -} - -model MetricDimensions { - @doc("The interval (i.e. timegrain) of the query.") - @query - interval?: Interval; - - @doc("Metric name") - @query - metricName?: string; - - @doc("Metric namespace to query metric definitions for.") - @query - metricNamespace: string; - - @doc(""" - The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - """) - @query - timespan?: string; -}; - -@resource("values") -@parentResource(Dimension) -model DimensionValueListItem { - @key - value: string[]; -} - -@resource("metric-dimensions") -@parentResource(TestRuns) -model Dimension { - @key - @doc("Dimension name") - @path("name") - @visibility("query") - name: string; -} - -@doc("Load test run model") -@resource("test-runs") -model TestRuns { - // FIXME: is testRunId optional or required in the response? Resource key and path params cannot be optional - @key - @path - @doc("Unique test run name as identifier") - @visibility("read") - testRunId: string; -} - -// -// ** Operations ** -// - -@route("/app") -namespace Pagination { - @summary("Gets ledger entries from a collection corresponding to a range.") - @doc("A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned.") - op ListPaginationLedgerEntries is Azure.Core.Foundations.ResourceList; -} - -interface AdditionalParameter { - @summary("List the dimension values for the given metric dimension name.") - @doc("List the dimension values for the given metric dimension name.") - ListMetricDimensionValues is Azure.Core.ResourceList< - DimensionValueListItem, QueryParametersTrait - >; -} - -@route("/adp") -interface UseFoundationsResourceList { - @doc("List upload detail for the discovery resource.") - list is CustomResourceList; -} - -interface TwoTypesItem { - @summary("Get All Text Blocklists") - @doc("Get all text blocklists details.") - listTextBlocklists is Azure.Core.ResourceList; - - @summary("Get All BlockItems By blocklistName") - @doc("Get all blockItems in a text blocklist") - listTextBlocklistItems is Azure.Core.ResourceList< - TextBlockItem, - ListQueryParametersTrait - >; -} - - -@doc("The result of listing the Pools in an Account.") -@pagedResult -model BatchPoolListResult { - @doc("The list of Pools.") - @items - value?: BatchPool[]; - - #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" - @doc("The URL to get the next set of results.") - @nextLink - `odata.nextLink`?: string; -} - -@doc("A Pool in the Azure Batch service.") -model BatchPool { - @doc("A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case).") - @visibility("read") - id?: string; - - @doc("The display name for the Pool. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.") - @visibility("read") - displayName?: string; - - @doc("The URL of the Pool.") - @visibility("read") - url?: string; -} - -#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Model types must use camelCase" -@doc("Client related response header values") -model BatchRequestHeaders { - @doc(""" - An OData $filter clause. For more information on constructing this filter, see - https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. - """) - @query - $filter?: string; - - @doc("An OData $select clause.") - @query({ - format: "csv", - }) - $select?: string[]; - - @doc("An OData $expand clause.") - @query({ - format: "csv", - }) - $expand?: string[]; -} - -#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Model types must use camelCase" -@doc("Client related response header values") -model BatchResponseHeaders { - @doc("The client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true.") - @header - `client-request-id`?: string; - - @doc("A unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch Account against which the request was made, and the region that Account resides in.") - @header - `request-id`?: string; - - @doc("The ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers.") - @header - @clientName("etag", "python") - ETag?: string; - - @doc("The time at which the resource was last modified.") - @header - @encode(DateTimeKnownEncoding.rfc7231) - `Last-Modified`?: utcDateTime; -} - -@doc("An error response received from the Azure Batch service.") -@error -model BatchError { - @doc("An identifier for the error. Codes are invariant and are intended to be consumed programmatically.") - code: string; -} - -interface Pools { - @doc("Lists all of the Pools in the specified Account.") - @route("/pools") - @get - @convenientAPI(true) - listPools is RpcOperation< - BatchRequestHeaders, - BatchPoolListResult, - BatchResponseHeaders, - BatchError - >; -} diff --git a/test/TestProjects/Pagination-TypeSpec/Pagination.sln b/test/TestProjects/Pagination-TypeSpec/Pagination.sln deleted file mode 100644 index 64a24b9d64b..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/Pagination.sln +++ /dev/null @@ -1,50 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29709.97 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pagination", "src\Pagination.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pagination.Tests", "tests\Pagination.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} - EndGlobalSection -EndGlobal diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/AdditionalParameter.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/AdditionalParameter.cs deleted file mode 100644 index bb6addf5d0c..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/AdditionalParameter.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Pagination.Models; - -namespace Pagination -{ - // Data plane generated sub-client. - /// The AdditionalParameter sub-client. - public partial class AdditionalParameter - { - private static readonly string[] AuthorizationScopes = new string[] { "https://pagination.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of AdditionalParameter for mocking. - protected AdditionalParameter() - { - } - - /// Initializes a new instance of AdditionalParameter. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// The to use. - /// The API version to use for this operation. - internal AdditionalParameter(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// List the dimension values for the given metric dimension name. - /// Unique test run name as identifier. - /// Dimension name. - /// Metric namespace to query metric definitions for. - /// The interval (i.e. timegrain) of the query. - /// Metric name. - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// - public virtual AsyncPageable GetMetricDimensionValuesAsync(string testRunId, string name, string metricNamespace, Interval? interval = null, string metricName = null, string timespan = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricNamespace, interval?.ToString(), metricName, timespan, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricNamespace, interval?.ToString(), metricName, timespan, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DimensionValueListItem.DeserializeDimensionValueListItem(e), ClientDiagnostics, _pipeline, "AdditionalParameter.GetMetricDimensionValues", "value", "nextLink", context); - } - - /// List the dimension values for the given metric dimension name. - /// Unique test run name as identifier. - /// Dimension name. - /// Metric namespace to query metric definitions for. - /// The interval (i.e. timegrain) of the query. - /// Metric name. - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// - public virtual Pageable GetMetricDimensionValues(string testRunId, string name, string metricNamespace, Interval? interval = null, string metricName = null, string timespan = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricNamespace, interval?.ToString(), metricName, timespan, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricNamespace, interval?.ToString(), metricName, timespan, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DimensionValueListItem.DeserializeDimensionValueListItem(e), ClientDiagnostics, _pipeline, "AdditionalParameter.GetMetricDimensionValues", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List the dimension values for the given metric dimension name. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Unique test run name as identifier. - /// Dimension name. - /// Metric namespace to query metric definitions for. - /// The interval (i.e. timegrain) of the query. Allowed values: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H". - /// Metric name. - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetMetricDimensionValuesAsync(string testRunId, string name, string metricNamespace, string interval, string metricName, string timespan, RequestContext context) - { - Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricNamespace, interval, metricName, timespan, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricNamespace, interval, metricName, timespan, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AdditionalParameter.GetMetricDimensionValues", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List the dimension values for the given metric dimension name. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Unique test run name as identifier. - /// Dimension name. - /// Metric namespace to query metric definitions for. - /// The interval (i.e. timegrain) of the query. Allowed values: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H". - /// Metric name. - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetMetricDimensionValues(string testRunId, string name, string metricNamespace, string interval, string metricName, string timespan, RequestContext context) - { - Argument.AssertNotNullOrEmpty(testRunId, nameof(testRunId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(metricNamespace, nameof(metricNamespace)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMetricDimensionValuesRequest(testRunId, name, metricNamespace, interval, metricName, timespan, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMetricDimensionValuesNextPageRequest(nextLink, testRunId, name, metricNamespace, interval, metricName, timespan, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AdditionalParameter.GetMetricDimensionValues", "value", "nextLink", context); - } - - internal HttpMessage CreateGetMetricDimensionValuesRequest(string testRunId, string name, string metricNamespace, string interval, string metricName, string timespan, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/test-runs/", false); - uri.AppendPath(testRunId, true); - uri.AppendPath("/metric-dimensions/", false); - uri.AppendPath(name, true); - uri.AppendPath("/values", false); - uri.AppendQuery("metricNamespace", metricNamespace, true); - uri.AppendQuery("api-version", _apiVersion, true); - if (interval != null) - { - uri.AppendQuery("interval", interval, true); - } - if (metricName != null) - { - uri.AppendQuery("metricName", metricName, true); - } - if (timespan != null) - { - uri.AppendQuery("timespan", timespan, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetMetricDimensionValuesNextPageRequest(string nextLink, string testRunId, string name, string metricNamespace, string interval, string metricName, string timespan, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/AdditionalParameter.xml b/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/AdditionalParameter.xml deleted file mode 100644 index 5b9473c86a2..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/AdditionalParameter.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - -This sample shows how to call GetMetricDimensionValuesAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -await foreach (DimensionValueListItem item in client.GetMetricDimensionValuesAsync("", "", "")) -{ -} -]]> -This sample shows how to call GetMetricDimensionValuesAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -await foreach (DimensionValueListItem item in client.GetMetricDimensionValuesAsync("", "", "", interval: Interval.PT5S, metricName: "", timespan: "")) -{ -} -]]> - - - -This sample shows how to call GetMetricDimensionValues. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -foreach (DimensionValueListItem item in client.GetMetricDimensionValues("", "", "")) -{ -} -]]> -This sample shows how to call GetMetricDimensionValues with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -foreach (DimensionValueListItem item in client.GetMetricDimensionValues("", "", "", interval: Interval.PT5S, metricName: "", timespan: "")) -{ -} -]]> - - - -This sample shows how to call GetMetricDimensionValuesAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("", "", "", null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); -} -]]> -This sample shows how to call GetMetricDimensionValuesAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("", "", "", "PT5S", "", "", null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); -} -]]> - - - -This sample shows how to call GetMetricDimensionValues and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetMetricDimensionValues("", "", "", null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); -} -]]> -This sample shows how to call GetMetricDimensionValues with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetMetricDimensionValues("", "", "", "PT5S", "", "", null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); -} -]]> - - - \ No newline at end of file diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/Pagination.xml b/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/Pagination.xml deleted file mode 100644 index b75c7bbd881..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/Pagination.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - -This sample shows how to call GetPaginationLedgerEntriesAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); -await foreach (LedgerEntry item in client.GetPaginationLedgerEntriesAsync(bodyInput)) -{ -} -]]> -This sample shows how to call GetPaginationLedgerEntriesAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); -await foreach (LedgerEntry item in client.GetPaginationLedgerEntriesAsync(bodyInput)) -{ -} -]]> - - - -This sample shows how to call GetPaginationLedgerEntries. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); -foreach (LedgerEntry item in client.GetPaginationLedgerEntries(bodyInput)) -{ -} -]]> -This sample shows how to call GetPaginationLedgerEntries with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); -foreach (LedgerEntry item in client.GetPaginationLedgerEntries(bodyInput)) -{ -} -]]> - - - -This sample shows how to call GetPaginationLedgerEntriesAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -using RequestContent content = RequestContent.Create(new -{ - requiredString = "", - requiredInt = 1234, -}); -await foreach (BinaryData item in client.GetPaginationLedgerEntriesAsync(content)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> -This sample shows how to call GetPaginationLedgerEntriesAsync with all request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -using RequestContent content = RequestContent.Create(new -{ - requiredString = "", - requiredInt = 1234, -}); -await foreach (BinaryData item in client.GetPaginationLedgerEntriesAsync(content)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> - - - -This sample shows how to call GetPaginationLedgerEntries and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -using RequestContent content = RequestContent.Create(new -{ - requiredString = "", - requiredInt = 1234, -}); -foreach (BinaryData item in client.GetPaginationLedgerEntries(content)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> -This sample shows how to call GetPaginationLedgerEntries with all request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - -using RequestContent content = RequestContent.Create(new -{ - requiredString = "", - requiredInt = 1234, -}); -foreach (BinaryData item in client.GetPaginationLedgerEntries(content)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> - - - \ No newline at end of file diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/Pools.xml b/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/Pools.xml deleted file mode 100644 index 0627886f752..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/Pools.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - -This sample shows how to call GetPoolsAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -await foreach (BatchPool item in client.GetPoolsAsync()) -{ -} -]]> -This sample shows how to call GetPoolsAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -await foreach (BatchPool item in client.GetPoolsAsync(filter: "<$filter>", select: new string[] { "<$select>" }, expand: new string[] { "<$expand>" })) -{ -} -]]> - - - -This sample shows how to call GetPools. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -foreach (BatchPool item in client.GetPools()) -{ -} -]]> -This sample shows how to call GetPools with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -foreach (BatchPool item in client.GetPools(filter: "<$filter>", select: new string[] { "<$select>" }, expand: new string[] { "<$expand>" })) -{ -} -]]> - - - -This sample shows how to call GetPoolsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetPoolsAsync(null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); -} -]]> -This sample shows how to call GetPoolsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetPoolsAsync("<$filter>", new string[] { "<$select>" }, new string[] { "<$expand>" }, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("url").ToString()); -} -]]> - - - -This sample shows how to call GetPools and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetPools(null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); -} -]]> -This sample shows how to call GetPools with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetPools("<$filter>", new string[] { "<$select>" }, new string[] { "<$expand>" }, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("url").ToString()); -} -]]> - - - \ No newline at end of file diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/TwoTypesItem.xml b/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/TwoTypesItem.xml deleted file mode 100644 index ce84a232913..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/TwoTypesItem.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - -This sample shows how to call GetTextBlocklistsAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (TextBlocklist item in client.GetTextBlocklistsAsync()) -{ -} -]]> -This sample shows how to call GetTextBlocklistsAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (TextBlocklist item in client.GetTextBlocklistsAsync()) -{ -} -]]> - - - -This sample shows how to call GetTextBlocklists. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (TextBlocklist item in client.GetTextBlocklists()) -{ -} -]]> -This sample shows how to call GetTextBlocklists with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (TextBlocklist item in client.GetTextBlocklists()) -{ -} -]]> - - - -This sample shows how to call GetTextBlocklistsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetTextBlocklistsAsync(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); -} -]]> -This sample shows how to call GetTextBlocklistsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetTextBlocklistsAsync(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); -} -]]> - - - -This sample shows how to call GetTextBlocklists and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetTextBlocklists(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); -} -]]> -This sample shows how to call GetTextBlocklists with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetTextBlocklists(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); -} -]]> - - - -This sample shows how to call GetTextBlocklistItemsAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (TextBlockItem item in client.GetTextBlocklistItemsAsync("")) -{ -} -]]> -This sample shows how to call GetTextBlocklistItemsAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (TextBlockItem item in client.GetTextBlocklistItemsAsync("", maxCount: 1234, skip: 1234, maxpagesize: 1234)) -{ -} -]]> - - - -This sample shows how to call GetTextBlocklistItems. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (TextBlockItem item in client.GetTextBlocklistItems("")) -{ -} -]]> -This sample shows how to call GetTextBlocklistItems with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (TextBlockItem item in client.GetTextBlocklistItems("", maxCount: 1234, skip: 1234, maxpagesize: 1234)) -{ -} -]]> - - - -This sample shows how to call GetTextBlocklistItemsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetTextBlocklistItemsAsync("", null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); -} -]]> -This sample shows how to call GetTextBlocklistItemsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetTextBlocklistItemsAsync("", 1234, 1234, 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); -} -]]> - - - -This sample shows how to call GetTextBlocklistItems and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetTextBlocklistItems("", null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); -} -]]> -This sample shows how to call GetTextBlocklistItems with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetTextBlocklistItems("", 1234, 1234, 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); -} -]]> - - - \ No newline at end of file diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/UseFoundationsResourceList.xml b/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/UseFoundationsResourceList.xml deleted file mode 100644 index eadd4c2bb00..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Docs/UseFoundationsResourceList.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -This sample shows how to call GetLedgerEntriesAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -await foreach (LedgerEntry item in client.GetLedgerEntriesAsync()) -{ -} -]]> -This sample shows how to call GetLedgerEntriesAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -await foreach (LedgerEntry item in client.GetLedgerEntriesAsync()) -{ -} -]]> - - - -This sample shows how to call GetLedgerEntries. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -foreach (LedgerEntry item in client.GetLedgerEntries()) -{ -} -]]> -This sample shows how to call GetLedgerEntries with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -foreach (LedgerEntry item in client.GetLedgerEntries()) -{ -} -]]> - - - -This sample shows how to call GetLedgerEntriesAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetLedgerEntriesAsync(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> -This sample shows how to call GetLedgerEntriesAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -await foreach (BinaryData item in client.GetLedgerEntriesAsync(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> - - - -This sample shows how to call GetLedgerEntries and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetLedgerEntries(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> -This sample shows how to call GetLedgerEntries with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - -foreach (BinaryData item in client.GetLedgerEntries(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); -} -]]> - - - \ No newline at end of file diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Argument.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Argument.cs deleted file mode 100644 index 90b8ab094df..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Argument.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Pagination -{ - internal static class Argument - { - public static void AssertNotNull(T value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - } - - public static void AssertNotNull(T? value, string name) - where T : struct - { - if (!value.HasValue) - { - throw new ArgumentNullException(name); - } - } - - public static void AssertNotNullOrEmpty(IEnumerable value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value is ICollection collectionOfT && collectionOfT.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - if (value is ICollection collection && collection.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - using IEnumerator e = value.GetEnumerator(); - if (!e.MoveNext()) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - } - - public static void AssertNotNullOrEmpty(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value.Length == 0) - { - throw new ArgumentException("Value cannot be an empty string.", name); - } - } - - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - public static void AssertNotDefault(ref T value, string name) - where T : struct, IEquatable - { - if (value.Equals(default)) - { - throw new ArgumentException("Value cannot be empty.", name); - } - } - - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - public static void AssertEnumDefined(Type enumType, object value, string name) - { - if (!Enum.IsDefined(enumType, value)) - { - throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); - } - } - - public static T CheckNotNull(T value, string name) - where T : class - { - AssertNotNull(value, name); - return value; - } - - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - - public static void AssertNull(T value, string name, string message = null) - { - if (value != null) - { - throw new ArgumentException(message ?? "Value must be null.", name); - } - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ChangeTrackingDictionary.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ChangeTrackingDictionary.cs deleted file mode 100644 index dd389699cf9..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ChangeTrackingDictionary.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Pagination -{ - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull - { - private IDictionary _innerDictionary; - - public ChangeTrackingDictionary() - { - } - - public ChangeTrackingDictionary(IDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(dictionary); - } - - public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(); - foreach (var pair in dictionary) - { - _innerDictionary.Add(pair); - } - } - - public bool IsUndefined => _innerDictionary == null; - - public int Count => IsUndefined ? 0 : EnsureDictionary().Count; - - public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; - - public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; - - public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; - - public TValue this[TKey key] - { - get - { - if (IsUndefined) - { - throw new KeyNotFoundException(nameof(key)); - } - return EnsureDictionary()[key]; - } - set - { - EnsureDictionary()[key] = value; - } - } - - IEnumerable IReadOnlyDictionary.Keys => Keys; - - IEnumerable IReadOnlyDictionary.Values => Values; - - public IEnumerator> GetEnumerator() - { - if (IsUndefined) - { - IEnumerator> enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureDictionary().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public void Add(KeyValuePair item) - { - EnsureDictionary().Add(item); - } - - public void Clear() - { - EnsureDictionary().Clear(); - } - - public bool Contains(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Contains(item); - } - - public void CopyTo(KeyValuePair[] array, int index) - { - if (IsUndefined) - { - return; - } - EnsureDictionary().CopyTo(array, index); - } - - public bool Remove(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(item); - } - - public void Add(TKey key, TValue value) - { - EnsureDictionary().Add(key, value); - } - - public bool ContainsKey(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().ContainsKey(key); - } - - public bool Remove(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(key); - } - - public bool TryGetValue(TKey key, out TValue value) - { - if (IsUndefined) - { - value = default; - return false; - } - return EnsureDictionary().TryGetValue(key, out value); - } - - public IDictionary EnsureDictionary() - { - return _innerDictionary ??= new Dictionary(); - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ChangeTrackingList.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ChangeTrackingList.cs deleted file mode 100644 index 114dd1f0155..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ChangeTrackingList.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace Pagination -{ - internal class ChangeTrackingList : IList, IReadOnlyList - { - private IList _innerList; - - public ChangeTrackingList() - { - } - - public ChangeTrackingList(IList innerList) - { - if (innerList != null) - { - _innerList = innerList; - } - } - - public ChangeTrackingList(IReadOnlyList innerList) - { - if (innerList != null) - { - _innerList = innerList.ToList(); - } - } - - public bool IsUndefined => _innerList == null; - - public int Count => IsUndefined ? 0 : EnsureList().Count; - - public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; - - public T this[int index] - { - get - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - return EnsureList()[index]; - } - set - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList()[index] = value; - } - } - - public void Reset() - { - _innerList = null; - } - - public IEnumerator GetEnumerator() - { - if (IsUndefined) - { - IEnumerator enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureList().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public void Add(T item) - { - EnsureList().Add(item); - } - - public void Clear() - { - EnsureList().Clear(); - } - - public bool Contains(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Contains(item); - } - - public void CopyTo(T[] array, int arrayIndex) - { - if (IsUndefined) - { - return; - } - EnsureList().CopyTo(array, arrayIndex); - } - - public bool Remove(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Remove(item); - } - - public int IndexOf(T item) - { - if (IsUndefined) - { - return -1; - } - return EnsureList().IndexOf(item); - } - - public void Insert(int index, T item) - { - EnsureList().Insert(index, item); - } - - public void RemoveAt(int index) - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList().RemoveAt(index); - } - - public IList EnsureList() - { - return _innerList ??= new List(); - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs deleted file mode 100644 index 0690c867990..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Text.Json; -using System.Xml; -using Azure.Core; - -namespace Pagination -{ - internal static class ModelSerializationExtensions - { - internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - - public static object GetObject(this JsonElement element) - { - switch (element.ValueKind) - { - case JsonValueKind.String: - return element.GetString(); - case JsonValueKind.Number: - if (element.TryGetInt32(out int intValue)) - { - return intValue; - } - if (element.TryGetInt64(out long longValue)) - { - return longValue; - } - return element.GetDouble(); - case JsonValueKind.True: - return true; - case JsonValueKind.False: - return false; - case JsonValueKind.Undefined: - case JsonValueKind.Null: - return null; - case JsonValueKind.Object: - var dictionary = new Dictionary(); - foreach (var jsonProperty in element.EnumerateObject()) - { - dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); - } - return dictionary; - case JsonValueKind.Array: - var list = new List(); - foreach (var item in element.EnumerateArray()) - { - list.Add(item.GetObject()); - } - return list.ToArray(); - default: - throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); - } - } - - public static byte[] GetBytesFromBase64(this JsonElement element, string format) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - - return format switch - { - "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), - "D" => element.GetBytesFromBase64(), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - } - - public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch - { - "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), - _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) - }; - - public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); - - public static char GetChar(this JsonElement element) - { - if (element.ValueKind == JsonValueKind.String) - { - var text = element.GetString(); - if (text == null || text.Length != 1) - { - throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); - } - return text[0]; - } - else - { - throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); - } - } - - [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) - { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); - } - - public static string GetRequiredString(this JsonElement element) - { - var value = element.GetString(); - if (value == null) - { - throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); - } - return value; - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, char value) - { - writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); - } - - public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) - { - if (value == null) - { - writer.WriteNullValue(); - return; - } - switch (format) - { - case "U": - writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); - break; - case "D": - writer.WriteBase64StringValue(value); - break; - default: - throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); - } - } - - public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - if (format != "U") - { - throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); - } - writer.WriteNumberValue(value.ToUnixTimeSeconds()); - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) - { - switch (value) - { - case null: - writer.WriteNullValue(); - break; - case IJsonModel jsonModel: - jsonModel.Write(writer, options ?? WireOptions); - break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; - case byte[] bytes: - writer.WriteBase64StringValue(bytes); - break; - case BinaryData bytes0: - writer.WriteBase64StringValue(bytes0); - break; - case JsonElement json: - json.WriteTo(writer); - break; - case int i: - writer.WriteNumberValue(i); - break; - case decimal d: - writer.WriteNumberValue(d); - break; - case double d0: - if (double.IsNaN(d0)) - { - writer.WriteStringValue("NaN"); - } - else - { - writer.WriteNumberValue(d0); - } - break; - case float f: - writer.WriteNumberValue(f); - break; - case long l: - writer.WriteNumberValue(l); - break; - case string s: - writer.WriteStringValue(s); - break; - case bool b: - writer.WriteBooleanValue(b); - break; - case Guid g: - writer.WriteStringValue(g); - break; - case DateTimeOffset dateTimeOffset: - writer.WriteStringValue(dateTimeOffset, "O"); - break; - case DateTime dateTime: - writer.WriteStringValue(dateTime, "O"); - break; - case IEnumerable> enumerable: - writer.WriteStartObject(); - foreach (var pair in enumerable) - { - writer.WritePropertyName(pair.Key); - writer.WriteObjectValue(pair.Value, options); - } - writer.WriteEndObject(); - break; - case IEnumerable objectEnumerable: - writer.WriteStartArray(); - foreach (var item in objectEnumerable) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - break; - case TimeSpan timeSpan: - writer.WriteStringValue(timeSpan, "P"); - break; - default: - throw new NotSupportedException($"Not supported type {value.GetType()}"); - } - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) - { - writer.WriteObjectValue(value, options); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Optional.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Optional.cs deleted file mode 100644 index d1098bbcad5..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Optional.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; - -namespace Pagination -{ - internal static class Optional - { - public static bool IsCollectionDefined(IEnumerable collection) - { - return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); - } - - public static bool IsCollectionDefined(IDictionary collection) - { - return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); - } - - public static bool IsCollectionDefined(IReadOnlyDictionary collection) - { - return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); - } - - public static bool IsDefined(T? value) - where T : struct - { - return value.HasValue; - } - - public static bool IsDefined(object value) - { - return value != null; - } - - public static bool IsDefined(JsonElement value) - { - return value.ValueKind != JsonValueKind.Undefined; - } - - public static bool IsDefined(string value) - { - return value != null; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Utf8JsonRequestContent.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Utf8JsonRequestContent.cs deleted file mode 100644 index 6ef00e9f3d2..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Internal/Utf8JsonRequestContent.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.IO; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Pagination -{ - internal class Utf8JsonRequestContent : RequestContent - { - private readonly MemoryStream _stream; - private readonly RequestContent _content; - - public Utf8JsonRequestContent() - { - _stream = new MemoryStream(); - _content = Create(_stream); - JsonWriter = new Utf8JsonWriter(_stream); - } - - public Utf8JsonWriter JsonWriter { get; } - - public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) - { - await JsonWriter.FlushAsync().ConfigureAwait(false); - await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); - } - - public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) - { - JsonWriter.Flush(); - _content.WriteTo(stream, cancellationToken); - } - - public override bool TryComputeLength(out long length) - { - length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; - return true; - } - - public override void Dispose() - { - JsonWriter.Dispose(); - _content.Dispose(); - _stream.Dispose(); - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/BatchPool.Serialization.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/BatchPool.Serialization.cs deleted file mode 100644 index 6cbaf3c748f..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/BatchPool.Serialization.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Pagination.Models -{ - public partial class BatchPool : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BatchPool)} does not support writing '{format}' format."); - } - - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - BatchPool IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BatchPool)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBatchPool(document.RootElement, options); - } - - internal static BatchPool DeserializeBatchPool(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string displayName = default; - string url = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("displayName"u8)) - { - displayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BatchPool(id, displayName, url, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(BatchPool)} does not support writing '{options.Format}' format."); - } - } - - BatchPool IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeBatchPool(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BatchPool)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static BatchPool FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeBatchPool(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/BatchPool.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/BatchPool.cs deleted file mode 100644 index 12049dcf092..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/BatchPool.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Pagination.Models -{ - /// A Pool in the Azure Batch service. - public partial class BatchPool - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal BatchPool() - { - } - - /// Initializes a new instance of . - /// A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). - /// The display name for the Pool. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. - /// The URL of the Pool. - /// Keeps track of any properties unknown to the library. - internal BatchPool(string id, string displayName, string url, IDictionary serializedAdditionalRawData) - { - Id = id; - DisplayName = displayName; - Url = url; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). - public string Id { get; } - /// The display name for the Pool. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. - public string DisplayName { get; } - /// The URL of the Pool. - public string Url { get; } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/DimensionValueListItem.Serialization.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/DimensionValueListItem.Serialization.cs deleted file mode 100644 index 4fcb3027ff1..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/DimensionValueListItem.Serialization.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Pagination.Models -{ - public partial class DimensionValueListItem : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DimensionValueListItem)} does not support writing '{format}' format."); - } - - writer.WriteStartObject(); - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - DimensionValueListItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DimensionValueListItem)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDimensionValueListItem(document.RootElement, options); - } - - internal static DimensionValueListItem DeserializeDimensionValueListItem(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - value = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DimensionValueListItem(value, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(DimensionValueListItem)} does not support writing '{options.Format}' format."); - } - } - - DimensionValueListItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeDimensionValueListItem(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DimensionValueListItem)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DimensionValueListItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDimensionValueListItem(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/DimensionValueListItem.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/DimensionValueListItem.cs deleted file mode 100644 index 9927cdf4325..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/DimensionValueListItem.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Pagination.Models -{ - /// The DimensionValueListItem. - public partial class DimensionValueListItem - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// is null. - internal DimensionValueListItem(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal DimensionValueListItem(IReadOnlyList value, IDictionary serializedAdditionalRawData) - { - Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DimensionValueListItem() - { - } - - /// Gets the value. - public IReadOnlyList Value { get; } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/Interval.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/Interval.cs deleted file mode 100644 index 771cf24c6e8..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/Interval.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Pagination.Models -{ - /// The interval. - public readonly partial struct Interval : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public Interval(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PT5SValue = "PT5S"; - private const string PT10SValue = "PT10S"; - private const string PT1MValue = "PT1M"; - private const string PT5MValue = "PT5M"; - private const string PT1HValue = "PT1H"; - - /// 5 seconds, available only if test run duration is less than 10 minutes. - public static Interval PT5S { get; } = new Interval(PT5SValue); - /// 10 seconds, available only if test run duration is less than 10 minutes. - public static Interval PT10S { get; } = new Interval(PT10SValue); - /// 1 minute. - public static Interval PT1M { get; } = new Interval(PT1MValue); - /// 5 minutes, available only if test run duration is greater than 1 minute. - public static Interval PT5M { get; } = new Interval(PT5MValue); - /// 1 hour, available only if test run duration is greater than 1 minute. - public static Interval PT1H { get; } = new Interval(PT1HValue); - /// Determines if two values are the same. - public static bool operator ==(Interval left, Interval right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(Interval left, Interval right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator Interval(string value) => new Interval(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is Interval other && Equals(other); - /// - public bool Equals(Interval other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/LedgerEntry.Serialization.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/LedgerEntry.Serialization.cs deleted file mode 100644 index 8736f965252..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/LedgerEntry.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Pagination.Models -{ - public partial class LedgerEntry : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(LedgerEntry)} does not support writing '{format}' format."); - } - - writer.WriteStartObject(); - writer.WritePropertyName("contents"u8); - writer.WriteStringValue(Contents); - if (options.Format != "W") - { - writer.WritePropertyName("collectionId"u8); - writer.WriteStringValue(CollectionId); - } - if (options.Format != "W") - { - writer.WritePropertyName("transactionId"u8); - writer.WriteStringValue(TransactionId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - LedgerEntry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(LedgerEntry)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLedgerEntry(document.RootElement, options); - } - - internal static LedgerEntry DeserializeLedgerEntry(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string contents = default; - string collectionId = default; - string transactionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("contents"u8)) - { - contents = property.Value.GetString(); - continue; - } - if (property.NameEquals("collectionId"u8)) - { - collectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new LedgerEntry(contents, collectionId, transactionId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(LedgerEntry)} does not support writing '{options.Format}' format."); - } - } - - LedgerEntry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeLedgerEntry(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LedgerEntry)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static LedgerEntry FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeLedgerEntry(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/LedgerEntry.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/LedgerEntry.cs deleted file mode 100644 index cdeb55b0cfa..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/LedgerEntry.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Pagination.Models -{ - /// The LedgerEntry. - public partial class LedgerEntry - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Contents of the ledger entry. - /// is null. - internal LedgerEntry(string contents) - { - Argument.AssertNotNull(contents, nameof(contents)); - - Contents = contents; - } - - /// Initializes a new instance of . - /// Contents of the ledger entry. - /// - /// - /// Keeps track of any properties unknown to the library. - internal LedgerEntry(string contents, string collectionId, string transactionId, IDictionary serializedAdditionalRawData) - { - Contents = contents; - CollectionId = collectionId; - TransactionId = transactionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LedgerEntry() - { - } - - /// Contents of the ledger entry. - public string Contents { get; } - /// Gets the collection id. - public string CollectionId { get; } - /// Gets the transaction id. - public string TransactionId { get; } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/ListLedgerEntryInputBody.Serialization.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/ListLedgerEntryInputBody.Serialization.cs deleted file mode 100644 index 9333decae09..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/ListLedgerEntryInputBody.Serialization.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Pagination.Models -{ - public partial class ListLedgerEntryInputBody : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ListLedgerEntryInputBody)} does not support writing '{format}' format."); - } - - writer.WriteStartObject(); - writer.WritePropertyName("requiredString"u8); - writer.WriteStringValue(RequiredString); - writer.WritePropertyName("requiredInt"u8); - writer.WriteNumberValue(RequiredInt); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - ListLedgerEntryInputBody IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ListLedgerEntryInputBody)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeListLedgerEntryInputBody(document.RootElement, options); - } - - internal static ListLedgerEntryInputBody DeserializeListLedgerEntryInputBody(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string requiredString = default; - int requiredInt = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("requiredString"u8)) - { - requiredString = property.Value.GetString(); - continue; - } - if (property.NameEquals("requiredInt"u8)) - { - requiredInt = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ListLedgerEntryInputBody(requiredString, requiredInt, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(ListLedgerEntryInputBody)} does not support writing '{options.Format}' format."); - } - } - - ListLedgerEntryInputBody IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeListLedgerEntryInputBody(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ListLedgerEntryInputBody)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ListLedgerEntryInputBody FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeListLedgerEntryInputBody(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/ListLedgerEntryInputBody.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/ListLedgerEntryInputBody.cs deleted file mode 100644 index 579e13d97b4..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/ListLedgerEntryInputBody.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Pagination.Models -{ - /// Type for input model body. - public partial class ListLedgerEntryInputBody - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Required string. - /// Required int. - /// is null. - public ListLedgerEntryInputBody(string requiredString, int requiredInt) - { - Argument.AssertNotNull(requiredString, nameof(requiredString)); - - RequiredString = requiredString; - RequiredInt = requiredInt; - } - - /// Initializes a new instance of . - /// Required string. - /// Required int. - /// Keeps track of any properties unknown to the library. - internal ListLedgerEntryInputBody(string requiredString, int requiredInt, IDictionary serializedAdditionalRawData) - { - RequiredString = requiredString; - RequiredInt = requiredInt; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ListLedgerEntryInputBody() - { - } - - /// Required string. - public string RequiredString { get; } - /// Required int. - public int RequiredInt { get; } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlockItem.Serialization.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlockItem.Serialization.cs deleted file mode 100644 index ea3ca26475a..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlockItem.Serialization.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Pagination.Models -{ - public partial class TextBlockItem : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(TextBlockItem)} does not support writing '{format}' format."); - } - - writer.WriteStartObject(); - writer.WritePropertyName("blockItemId"u8); - writer.WriteStringValue(BlockItemId); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - writer.WritePropertyName("text"u8); - writer.WriteStringValue(Text); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - TextBlockItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(TextBlockItem)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTextBlockItem(document.RootElement, options); - } - - internal static TextBlockItem DeserializeTextBlockItem(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string blockItemId = default; - string description = default; - string text = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("blockItemId"u8)) - { - blockItemId = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("text"u8)) - { - text = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new TextBlockItem(blockItemId, description, text, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(TextBlockItem)} does not support writing '{options.Format}' format."); - } - } - - TextBlockItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeTextBlockItem(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(TextBlockItem)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TextBlockItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTextBlockItem(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlockItem.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlockItem.cs deleted file mode 100644 index ed7e52aaef9..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlockItem.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Pagination.Models -{ - /// Item in TextBlocklist. - public partial class TextBlockItem - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Block Item Id. It will be uuid. - /// Block item content. - /// or is null. - internal TextBlockItem(string blockItemId, string text) - { - Argument.AssertNotNull(blockItemId, nameof(blockItemId)); - Argument.AssertNotNull(text, nameof(text)); - - BlockItemId = blockItemId; - Text = text; - } - - /// Initializes a new instance of . - /// Block Item Id. It will be uuid. - /// Block item description. - /// Block item content. - /// Keeps track of any properties unknown to the library. - internal TextBlockItem(string blockItemId, string description, string text, IDictionary serializedAdditionalRawData) - { - BlockItemId = blockItemId; - Description = description; - Text = text; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal TextBlockItem() - { - } - - /// Block Item Id. It will be uuid. - public string BlockItemId { get; } - /// Block item description. - public string Description { get; } - /// Block item content. - public string Text { get; } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlocklist.Serialization.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlocklist.Serialization.cs deleted file mode 100644 index bd07ada3dbb..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlocklist.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Pagination.Models -{ - public partial class TextBlocklist : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(TextBlocklist)} does not support writing '{format}' format."); - } - - writer.WriteStartObject(); - writer.WritePropertyName("blocklistName"u8); - writer.WriteStringValue(BlocklistName); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - TextBlocklist IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(TextBlocklist)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTextBlocklist(document.RootElement, options); - } - - internal static TextBlocklist DeserializeTextBlocklist(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string blocklistName = default; - string description = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("blocklistName"u8)) - { - blocklistName = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new TextBlocklist(blocklistName, description, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(TextBlocklist)} does not support writing '{options.Format}' format."); - } - } - - TextBlocklist IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeTextBlocklist(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(TextBlocklist)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TextBlocklist FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTextBlocklist(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlocklist.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlocklist.cs deleted file mode 100644 index d7cc2936d50..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Models/TextBlocklist.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Pagination.Models -{ - /// Text Blocklist. - public partial class TextBlocklist - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// is null. - internal TextBlocklist(string blocklistName) - { - Argument.AssertNotNull(blocklistName, nameof(blocklistName)); - - BlocklistName = blocklistName; - } - - /// Initializes a new instance of . - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// Text blocklist description. - /// Keeps track of any properties unknown to the library. - internal TextBlocklist(string blocklistName, string description, IDictionary serializedAdditionalRawData) - { - BlocklistName = blocklistName; - Description = description; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal TextBlocklist() - { - } - - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - public string BlocklistName { get; } - /// Text blocklist description. - public string Description { get; } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Pagination.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Pagination.cs deleted file mode 100644 index 62b6b9bc4a3..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Pagination.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Pagination.Models; - -namespace Pagination -{ - // Data plane generated sub-client. - /// The Pagination sub-client. - public partial class Pagination - { - private static readonly string[] AuthorizationScopes = new string[] { "https://pagination.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of Pagination for mocking. - protected Pagination() - { - } - - /// Initializes a new instance of Pagination. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// The to use. - /// The API version to use for this operation. - internal Pagination(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Gets ledger entries from a collection corresponding to a range. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. - /// - public virtual AsyncPageable GetPaginationLedgerEntriesAsync(ListLedgerEntryInputBody bodyInput, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(bodyInput, nameof(bodyInput)); - - RequestContent content = bodyInput.ToRequestContent(); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPaginationLedgerEntriesRequest(content, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPaginationLedgerEntriesNextPageRequest(nextLink, content, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => LedgerEntry.DeserializeLedgerEntry(e), ClientDiagnostics, _pipeline, "Pagination.GetPaginationLedgerEntries", "entries", "customNextLink", context); - } - - /// Gets ledger entries from a collection corresponding to a range. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. - /// - public virtual Pageable GetPaginationLedgerEntries(ListLedgerEntryInputBody bodyInput, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(bodyInput, nameof(bodyInput)); - - RequestContent content = bodyInput.ToRequestContent(); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPaginationLedgerEntriesRequest(content, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPaginationLedgerEntriesNextPageRequest(nextLink, content, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => LedgerEntry.DeserializeLedgerEntry(e), ClientDiagnostics, _pipeline, "Pagination.GetPaginationLedgerEntries", "entries", "customNextLink", context); - } - - /// - /// [Protocol Method] Gets ledger entries from a collection corresponding to a range. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetPaginationLedgerEntriesAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPaginationLedgerEntriesRequest(content, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPaginationLedgerEntriesNextPageRequest(nextLink, content, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Pagination.GetPaginationLedgerEntries", "entries", "customNextLink", context); - } - - /// - /// [Protocol Method] Gets ledger entries from a collection corresponding to a range. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetPaginationLedgerEntries(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPaginationLedgerEntriesRequest(content, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPaginationLedgerEntriesNextPageRequest(nextLink, content, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Pagination.GetPaginationLedgerEntries", "entries", "customNextLink", context); - } - - internal HttpMessage CreateGetPaginationLedgerEntriesRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/app/transactions", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetPaginationLedgerEntriesNextPageRequest(string nextLink, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClient.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClient.cs deleted file mode 100644 index cd332a4611d..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClient.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Pagination -{ - // Data plane generated client. - /// The Pagination service client. - public partial class PaginationClient - { - private static readonly string[] AuthorizationScopes = new string[] { "https://pagination.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of PaginationClient for mocking. - protected PaginationClient() - { - } - - /// Initializes a new instance of PaginationClient. - /// The to use. - /// A credential used to authenticate to an Azure Service. - /// or is null. - public PaginationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PaginationClientOptions()) - { - } - - /// Initializes a new instance of PaginationClient. - /// The to use. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - /// or is null. - public PaginationClient(Uri endpoint, TokenCredential credential, PaginationClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(credential, nameof(credential)); - options ??= new PaginationClientOptions(); - - ClientDiagnostics = new ClientDiagnostics(options, true); - _tokenCredential = credential; - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); - _endpoint = endpoint; - } - - /// Initializes a new instance of Pagination. - /// The API version to use for this operation. - /// is null. - public virtual Pagination GetClient(string apiVersion = "2022-05-13") - { - Argument.AssertNotNull(apiVersion, nameof(apiVersion)); - - return new Pagination(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); - } - - /// Initializes a new instance of AdditionalParameter. - /// The API version to use for this operation. - /// is null. - public virtual AdditionalParameter GetAdditionalParameterClient(string apiVersion = "2022-05-13") - { - Argument.AssertNotNull(apiVersion, nameof(apiVersion)); - - return new AdditionalParameter(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); - } - - /// Initializes a new instance of UseFoundationsResourceList. - /// The API version to use for this operation. - /// is null. - public virtual UseFoundationsResourceList GetUseFoundationsResourceListClient(string apiVersion = "2022-05-13") - { - Argument.AssertNotNull(apiVersion, nameof(apiVersion)); - - return new UseFoundationsResourceList(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); - } - - /// Initializes a new instance of TwoTypesItem. - /// The API version to use for this operation. - /// is null. - public virtual TwoTypesItem GetTwoTypesItemClient(string apiVersion = "2022-05-13") - { - Argument.AssertNotNull(apiVersion, nameof(apiVersion)); - - return new TwoTypesItem(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); - } - - /// Initializes a new instance of Pools. - /// The API version to use for this operation. - /// is null. - public virtual Pools GetPoolsClient(string apiVersion = "2022-05-13") - { - Argument.AssertNotNull(apiVersion, nameof(apiVersion)); - - return new Pools(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClientBuilderExtensions.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClientBuilderExtensions.cs deleted file mode 100644 index 901d949ddc9..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClientBuilderExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core.Extensions; -using Pagination; - -namespace Microsoft.Extensions.Azure -{ - /// Extension methods to add to client builder. - public static partial class PaginationClientBuilderExtensions - { - /// Registers a instance. - /// The builder to register with. - /// The to use. - public static IAzureClientBuilder AddPaginationClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilderWithCredential - { - return builder.RegisterClientFactory((options, cred) => new PaginationClient(endpoint, cred, options)); - } - - /// Registers a instance. - /// The builder to register with. - /// The configuration values. - public static IAzureClientBuilder AddPaginationClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration - { - return builder.RegisterClientFactory(configuration); - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClientOptions.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClientOptions.cs deleted file mode 100644 index 3af62d370a1..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationClientOptions.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Pagination -{ - /// Client options for PaginationClient. - public partial class PaginationClientOptions : ClientOptions - { - private const ServiceVersion LatestVersion = ServiceVersion.V2022_05_13; - - /// The version of the service to use. - public enum ServiceVersion - { - /// Service version "2022-05-13". - V2022_05_13 = 1, - } - - internal string Version { get; } - - /// Initializes new instance of PaginationClientOptions. - public PaginationClientOptions(ServiceVersion version = LatestVersion) - { - Version = version switch - { - ServiceVersion.V2022_05_13 => "2022-05-13", - _ => throw new NotSupportedException() - }; - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationModelFactory.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationModelFactory.cs deleted file mode 100644 index bb2550c3591..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/PaginationModelFactory.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Pagination.Models -{ - /// Model factory for models. - public static partial class PaginationModelFactory - { - /// Initializes a new instance of . - /// A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). - /// The display name for the Pool. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. - /// The URL of the Pool. - /// A new instance for mocking. - public static BatchPool BatchPool(string id = null, string displayName = null, string url = null) - { - return new BatchPool(id, displayName, url, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// Text blocklist description. - /// A new instance for mocking. - public static TextBlocklist TextBlocklist(string blocklistName = null, string description = null) - { - return new TextBlocklist(blocklistName, description, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Block Item Id. It will be uuid. - /// Block item description. - /// Block item content. - /// A new instance for mocking. - public static TextBlockItem TextBlockItem(string blockItemId = null, string description = null, string text = null) - { - return new TextBlockItem(blockItemId, description, text, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Contents of the ledger entry. - /// - /// - /// A new instance for mocking. - public static LedgerEntry LedgerEntry(string contents = null, string collectionId = null, string transactionId = null) - { - return new LedgerEntry(contents, collectionId, transactionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// A new instance for mocking. - public static DimensionValueListItem DimensionValueListItem(IEnumerable value = null) - { - value ??= new List(); - - return new DimensionValueListItem(value?.ToList(), serializedAdditionalRawData: null); - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/Pools.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/Pools.cs deleted file mode 100644 index 2437bba0bc8..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/Pools.cs +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Pagination.Models; - -namespace Pagination -{ - // Data plane generated sub-client. - /// The Pools sub-client. - public partial class Pools - { - private static readonly string[] AuthorizationScopes = new string[] { "https://pagination.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of Pools for mocking. - protected Pools() - { - } - - /// Initializes a new instance of Pools. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// The to use. - /// The API version to use for this operation. - internal Pools(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Lists all of the Pools in the specified Account. - /// - /// An OData $filter clause. For more information on constructing this filter, see - /// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. - /// - /// An OData $select clause. - /// An OData $expand clause. - /// The cancellation token to use. - /// - public virtual AsyncPageable GetPoolsAsync(string filter = null, IEnumerable select = null, IEnumerable expand = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(filter, select, expand, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, filter, select, expand, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BatchPool.DeserializeBatchPool(e), ClientDiagnostics, _pipeline, "Pools.GetPools", "value", "odata.nextLink", context); - } - - /// Lists all of the Pools in the specified Account. - /// - /// An OData $filter clause. For more information on constructing this filter, see - /// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. - /// - /// An OData $select clause. - /// An OData $expand clause. - /// The cancellation token to use. - /// - public virtual Pageable GetPools(string filter = null, IEnumerable select = null, IEnumerable expand = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(filter, select, expand, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, filter, select, expand, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BatchPool.DeserializeBatchPool(e), ClientDiagnostics, _pipeline, "Pools.GetPools", "value", "odata.nextLink", context); - } - - /// - /// [Protocol Method] Lists all of the Pools in the specified Account. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// - /// An OData $filter clause. For more information on constructing this filter, see - /// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. - /// - /// An OData $select clause. - /// An OData $expand clause. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetPoolsAsync(string filter, IEnumerable select, IEnumerable expand, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(filter, select, expand, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, filter, select, expand, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Pools.GetPools", "value", "odata.nextLink", context); - } - - /// - /// [Protocol Method] Lists all of the Pools in the specified Account. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// - /// An OData $filter clause. For more information on constructing this filter, see - /// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. - /// - /// An OData $select clause. - /// An OData $expand clause. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetPools(string filter, IEnumerable select, IEnumerable expand, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(filter, select, expand, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, filter, select, expand, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Pools.GetPools", "value", "odata.nextLink", context); - } - - internal HttpMessage CreateGetPoolsRequest(string filter, IEnumerable select, IEnumerable expand, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/pools", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (select != null && !(select is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("$select", select, ",", true); - } - if (expand != null && !(expand is ChangeTrackingList changeTrackingList0 && changeTrackingList0.IsUndefined)) - { - uri.AppendQueryDelimited("$expand", expand, ",", true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, string filter, IEnumerable select, IEnumerable expand, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/TwoTypesItem.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/TwoTypesItem.cs deleted file mode 100644 index 6d3bf1ba089..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/TwoTypesItem.cs +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Pagination.Models; - -namespace Pagination -{ - // Data plane generated sub-client. - /// The TwoTypesItem sub-client. - public partial class TwoTypesItem - { - private static readonly string[] AuthorizationScopes = new string[] { "https://pagination.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of TwoTypesItem for mocking. - protected TwoTypesItem() - { - } - - /// Initializes a new instance of TwoTypesItem. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// The to use. - /// The API version to use for this operation. - internal TwoTypesItem(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Get All Text Blocklists. - /// The cancellation token to use. - /// Get all text blocklists details. - /// - public virtual AsyncPageable GetTextBlocklistsAsync(CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => TextBlocklist.DeserializeTextBlocklist(e), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklists", "value", "nextLink", context); - } - - /// Get All Text Blocklists. - /// The cancellation token to use. - /// Get all text blocklists details. - /// - public virtual Pageable GetTextBlocklists(CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => TextBlocklist.DeserializeTextBlocklist(e), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklists", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Get All Text Blocklists - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetTextBlocklistsAsync(RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklists", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Get All Text Blocklists - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetTextBlocklists(RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklists", "value", "nextLink", context); - } - - /// Get All BlockItems By blocklistName. - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// The number of result items to return. - /// The number of result items to skip. - /// The maximum number of result items per page. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Get all blockItems in a text blocklist. - /// - public virtual AsyncPageable GetTextBlocklistItemsAsync(string blocklistName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(blocklistName, nameof(blocklistName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistItemsRequest(blocklistName, maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistItemsNextPageRequest(nextLink, blocklistName, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => TextBlockItem.DeserializeTextBlockItem(e), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklistItems", "value", "nextLink", context); - } - - /// Get All BlockItems By blocklistName. - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// The number of result items to return. - /// The number of result items to skip. - /// The maximum number of result items per page. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Get all blockItems in a text blocklist. - /// - public virtual Pageable GetTextBlocklistItems(string blocklistName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(blocklistName, nameof(blocklistName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistItemsRequest(blocklistName, maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistItemsNextPageRequest(nextLink, blocklistName, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => TextBlockItem.DeserializeTextBlockItem(e), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklistItems", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Get All BlockItems By blocklistName - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// The number of result items to return. - /// The number of result items to skip. - /// The maximum number of result items per page. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetTextBlocklistItemsAsync(string blocklistName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - Argument.AssertNotNullOrEmpty(blocklistName, nameof(blocklistName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistItemsRequest(blocklistName, maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistItemsNextPageRequest(nextLink, blocklistName, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklistItems", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Get All BlockItems By blocklistName - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~. - /// The number of result items to return. - /// The number of result items to skip. - /// The maximum number of result items per page. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetTextBlocklistItems(string blocklistName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - Argument.AssertNotNullOrEmpty(blocklistName, nameof(blocklistName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistItemsRequest(blocklistName, maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistItemsNextPageRequest(nextLink, blocklistName, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TwoTypesItem.GetTextBlocklistItems", "value", "nextLink", context); - } - - internal HttpMessage CreateGetTextBlocklistsRequest(RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/text/blocklists", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTextBlocklistItemsRequest(string blocklistName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/text/blocklists/", false); - uri.AppendPath(blocklistName, true); - uri.AppendPath("/blockItems", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTextBlocklistsNextPageRequest(string nextLink, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTextBlocklistItemsNextPageRequest(string nextLink, string blocklistName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Generated/UseFoundationsResourceList.cs b/test/TestProjects/Pagination-TypeSpec/src/Generated/UseFoundationsResourceList.cs deleted file mode 100644 index 17a555118ac..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Generated/UseFoundationsResourceList.cs +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Pagination.Models; - -namespace Pagination -{ - // Data plane generated sub-client. - /// The UseFoundationsResourceList sub-client. - public partial class UseFoundationsResourceList - { - private static readonly string[] AuthorizationScopes = new string[] { "https://pagination.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of UseFoundationsResourceList for mocking. - protected UseFoundationsResourceList() - { - } - - /// Initializes a new instance of UseFoundationsResourceList. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// The to use. - /// The API version to use for this operation. - internal UseFoundationsResourceList(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// List upload detail for the discovery resource. - /// The cancellation token to use. - /// - public virtual AsyncPageable GetLedgerEntriesAsync(CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLedgerEntriesRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLedgerEntriesNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => LedgerEntry.DeserializeLedgerEntry(e), ClientDiagnostics, _pipeline, "UseFoundationsResourceList.GetLedgerEntries", "value", "nextLink", context); - } - - /// List upload detail for the discovery resource. - /// The cancellation token to use. - /// - public virtual Pageable GetLedgerEntries(CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLedgerEntriesRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLedgerEntriesNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => LedgerEntry.DeserializeLedgerEntry(e), ClientDiagnostics, _pipeline, "UseFoundationsResourceList.GetLedgerEntries", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List upload detail for the discovery resource. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetLedgerEntriesAsync(RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLedgerEntriesRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLedgerEntriesNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "UseFoundationsResourceList.GetLedgerEntries", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List upload detail for the discovery resource. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetLedgerEntries(RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLedgerEntriesRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLedgerEntriesNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "UseFoundationsResourceList.GetLedgerEntries", "value", "nextLink", context); - } - - internal HttpMessage CreateGetLedgerEntriesRequest(RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/adp/transactions", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLedgerEntriesNextPageRequest(string nextLink, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/src/Pagination.csproj b/test/TestProjects/Pagination-TypeSpec/src/Pagination.csproj deleted file mode 100644 index f31058d66aa..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Pagination.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - This is the Pagination client library for developing .NET applications with rich experience. - Azure SDK Code Generation Pagination for Azure Data Plane - 1.0.0-beta.1 - Pagination - $(RequiredTargetFrameworks) - true - - - - - - - - - - - diff --git a/test/TestProjects/Pagination-TypeSpec/src/Properties/AssemblyInfo.cs b/test/TestProjects/Pagination-TypeSpec/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 86e2669fd2e..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Pagination.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_AdditionalParameter.cs b/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_AdditionalParameter.cs deleted file mode 100644 index 5384a6b08a6..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_AdditionalParameter.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; -using Pagination.Models; - -namespace Pagination.Samples -{ - public partial class Samples_AdditionalParameter - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DimensionValueListItem_GetMetricDimensionValues_ShortVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetMetricDimensionValues("", "", "", null, null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DimensionValueListItem_GetMetricDimensionValues_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("", "", "", null, null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DimensionValueListItem_GetMetricDimensionValues_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - foreach (DimensionValueListItem item in client.GetMetricDimensionValues("", "", "")) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DimensionValueListItem_GetMetricDimensionValues_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - await foreach (DimensionValueListItem item in client.GetMetricDimensionValuesAsync("", "", "")) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DimensionValueListItem_GetMetricDimensionValues_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetMetricDimensionValues("", "", "", "PT5S", "", "", null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DimensionValueListItem_GetMetricDimensionValues_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("", "", "", "PT5S", "", "", null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("value")[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DimensionValueListItem_GetMetricDimensionValues_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - foreach (DimensionValueListItem item in client.GetMetricDimensionValues("", "", "", interval: Interval.PT5S, metricName: "", timespan: "")) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DimensionValueListItem_GetMetricDimensionValues_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - AdditionalParameter client = new PaginationClient(endpoint, credential).GetAdditionalParameterClient(apiVersion: "2022-05-13"); - - await foreach (DimensionValueListItem item in client.GetMetricDimensionValuesAsync("", "", "", interval: Interval.PT5S, metricName: "", timespan: "")) - { - } - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_Pagination.cs b/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_Pagination.cs deleted file mode 100644 index f48a255498c..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_Pagination.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; -using Pagination.Models; - -namespace Pagination.Samples -{ - public partial class Samples_Pagination - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetPaginationLedgerEntries_ShortVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - using RequestContent content = RequestContent.Create(new - { - requiredString = "", - requiredInt = 1234, - }); - foreach (BinaryData item in client.GetPaginationLedgerEntries(content)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetPaginationLedgerEntries_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - using RequestContent content = RequestContent.Create(new - { - requiredString = "", - requiredInt = 1234, - }); - await foreach (BinaryData item in client.GetPaginationLedgerEntriesAsync(content)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetPaginationLedgerEntries_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); - foreach (LedgerEntry item in client.GetPaginationLedgerEntries(bodyInput)) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetPaginationLedgerEntries_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); - await foreach (LedgerEntry item in client.GetPaginationLedgerEntriesAsync(bodyInput)) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetPaginationLedgerEntries_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - using RequestContent content = RequestContent.Create(new - { - requiredString = "", - requiredInt = 1234, - }); - foreach (BinaryData item in client.GetPaginationLedgerEntries(content)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetPaginationLedgerEntries_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - using RequestContent content = RequestContent.Create(new - { - requiredString = "", - requiredInt = 1234, - }); - await foreach (BinaryData item in client.GetPaginationLedgerEntriesAsync(content)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetPaginationLedgerEntries_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); - foreach (LedgerEntry item in client.GetPaginationLedgerEntries(bodyInput)) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetPaginationLedgerEntries_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pagination client = new PaginationClient(endpoint, credential).GetClient(apiVersion: "2022-05-13"); - - ListLedgerEntryInputBody bodyInput = new ListLedgerEntryInputBody("", 1234); - await foreach (LedgerEntry item in client.GetPaginationLedgerEntriesAsync(bodyInput)) - { - } - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_Pools.cs b/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_Pools.cs deleted file mode 100644 index 24ba6d2d1ce..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_Pools.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; -using Pagination.Models; - -namespace Pagination.Samples -{ - public partial class Samples_Pools - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Pools_GetPools_ShortVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetPools(null, null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_Pools_GetPools_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetPoolsAsync(null, null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Pools_GetPools_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - foreach (BatchPool item in client.GetPools()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_Pools_GetPools_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - await foreach (BatchPool item in client.GetPoolsAsync()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Pools_GetPools_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetPools("<$filter>", new string[] { "<$select>" }, new string[] { "<$expand>" }, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("url").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_Pools_GetPools_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetPoolsAsync("<$filter>", new string[] { "<$select>" }, new string[] { "<$expand>" }, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("url").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Pools_GetPools_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - foreach (BatchPool item in client.GetPools(filter: "<$filter>", select: new string[] { "<$select>" }, expand: new string[] { "<$expand>" })) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_Pools_GetPools_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - Pools client = new PaginationClient(endpoint, credential).GetPoolsClient(apiVersion: "2022-05-13"); - - await foreach (BatchPool item in client.GetPoolsAsync(filter: "<$filter>", select: new string[] { "<$select>" }, expand: new string[] { "<$expand>" })) - { - } - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_TwoTypesItem.cs b/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_TwoTypesItem.cs deleted file mode 100644 index 218a699c694..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_TwoTypesItem.cs +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; -using Pagination.Models; - -namespace Pagination.Samples -{ - public partial class Samples_TwoTypesItem - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlocklist_GetTextBlocklists_ShortVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetTextBlocklists(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlocklist_GetTextBlocklists_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetTextBlocklistsAsync(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlocklist_GetTextBlocklists_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (TextBlocklist item in client.GetTextBlocklists()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlocklist_GetTextBlocklists_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (TextBlocklist item in client.GetTextBlocklistsAsync()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlocklist_GetTextBlocklists_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetTextBlocklists(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlocklist_GetTextBlocklists_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetTextBlocklistsAsync(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blocklistName").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlocklist_GetTextBlocklists_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (TextBlocklist item in client.GetTextBlocklists()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlocklist_GetTextBlocklists_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (TextBlocklist item in client.GetTextBlocklistsAsync()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlockItem_GetTextBlocklistItems_ShortVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetTextBlocklistItems("", null, null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlockItem_GetTextBlocklistItems_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetTextBlocklistItemsAsync("", null, null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlockItem_GetTextBlocklistItems_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (TextBlockItem item in client.GetTextBlocklistItems("")) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlockItem_GetTextBlocklistItems_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (TextBlockItem item in client.GetTextBlocklistItemsAsync("")) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlockItem_GetTextBlocklistItems_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetTextBlocklistItems("", 1234, 1234, 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlockItem_GetTextBlocklistItems_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetTextBlocklistItemsAsync("", 1234, 1234, 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("blockItemId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("text").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_TextBlockItem_GetTextBlocklistItems_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - foreach (TextBlockItem item in client.GetTextBlocklistItems("", maxCount: 1234, skip: 1234, maxpagesize: 1234)) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_TextBlockItem_GetTextBlocklistItems_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - TwoTypesItem client = new PaginationClient(endpoint, credential).GetTwoTypesItemClient(apiVersion: "2022-05-13"); - - await foreach (TextBlockItem item in client.GetTextBlocklistItemsAsync("", maxCount: 1234, skip: 1234, maxpagesize: 1234)) - { - } - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_UseFoundationsResourceList.cs b/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_UseFoundationsResourceList.cs deleted file mode 100644 index 2f1a0b793d8..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tests/Generated/Samples/Samples_UseFoundationsResourceList.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; -using Pagination.Models; - -namespace Pagination.Samples -{ - public partial class Samples_UseFoundationsResourceList - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetLedgerEntries_ShortVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetLedgerEntries(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetLedgerEntries_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetLedgerEntriesAsync(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetLedgerEntries_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - foreach (LedgerEntry item in client.GetLedgerEntries()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetLedgerEntries_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - await foreach (LedgerEntry item in client.GetLedgerEntriesAsync()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetLedgerEntries_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - foreach (BinaryData item in client.GetLedgerEntries(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetLedgerEntries_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - await foreach (BinaryData item in client.GetLedgerEntriesAsync(null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("contents").ToString()); - Console.WriteLine(result.GetProperty("collectionId").ToString()); - Console.WriteLine(result.GetProperty("transactionId").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LedgerEntry_GetLedgerEntries_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - foreach (LedgerEntry item in client.GetLedgerEntries()) - { - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LedgerEntry_GetLedgerEntries_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - UseFoundationsResourceList client = new PaginationClient(endpoint, credential).GetUseFoundationsResourceListClient(apiVersion: "2022-05-13"); - - await foreach (LedgerEntry item in client.GetLedgerEntriesAsync()) - { - } - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/tests/Pagination.Tests.csproj b/test/TestProjects/Pagination-TypeSpec/tests/Pagination.Tests.csproj deleted file mode 100644 index 4263b188fc4..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tests/Pagination.Tests.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - $(RequiredTargetFrameworks) - - $(NoWarn);CS1591 - - - - - - - - - - - - - - diff --git a/test/TestProjects/Pagination-TypeSpec/tspCodeModel.json b/test/TestProjects/Pagination-TypeSpec/tspCodeModel.json deleted file mode 100644 index 7abc4597ce6..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tspCodeModel.json +++ /dev/null @@ -1,1865 +0,0 @@ -{ - "$id": "1", - "Name": "Pagination", - "ApiVersions": [ - "2022-05-13" - ], - "Enums": [ - { - "$id": "2", - "Kind": "enum", - "Name": "Interval", - "CrossLanguageDefinitionId": "Pagination.Interval", - "ValueType": { - "$id": "3", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Values": [ - { - "$id": "4", - "Name": "PT5S", - "Value": "PT5S", - "Description": "5 seconds, available only if test run duration is less than 10 minutes", - "Decorators": [] - }, - { - "$id": "5", - "Name": "PT10S", - "Value": "PT10S", - "Description": "10 seconds, available only if test run duration is less than 10 minutes", - "Decorators": [] - }, - { - "$id": "6", - "Name": "PT1M", - "Value": "PT1M", - "Description": "1 minute", - "Decorators": [] - }, - { - "$id": "7", - "Name": "PT5M", - "Value": "PT5M", - "Description": "5 minutes, available only if test run duration is greater than 1 minute", - "Decorators": [] - }, - { - "$id": "8", - "Name": "PT1H", - "Value": "PT1H", - "Description": "1 hour, available only if test run duration is greater than 1 minute", - "Decorators": [] - } - ], - "Description": "The interval", - "IsExtensible": true, - "Usage": "Input", - "Decorators": [] - }, - { - "$id": "9", - "Kind": "enum", - "Name": "Versions", - "CrossLanguageDefinitionId": "Pagination.Versions", - "ValueType": { - "$id": "10", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Values": [ - { - "$id": "11", - "Name": "2022-05-13", - "Value": "2022-05-13", - "Decorators": [] - } - ], - "IsExtensible": false, - "Usage": "ApiVersionEnum", - "Decorators": [] - } - ], - "Models": [ - { - "$id": "12", - "Kind": "model", - "Name": "BatchPoolListResult", - "CrossLanguageDefinitionId": "Pagination.BatchPoolListResult", - "Usage": "Output,Json", - "Description": "The result of listing the Pools in an Account.", - "Decorators": [], - "Properties": [ - { - "$id": "13", - "Name": "value", - "SerializedName": "value", - "Description": "The list of Pools.", - "Type": { - "$id": "14", - "Kind": "array", - "Name": "ArrayBatchPool", - "ValueType": { - "$id": "15", - "Kind": "model", - "Name": "BatchPool", - "CrossLanguageDefinitionId": "Pagination.BatchPool", - "Usage": "Output,Json", - "Description": "A Pool in the Azure Batch service.", - "Decorators": [], - "Properties": [ - { - "$id": "16", - "Name": "id", - "SerializedName": "id", - "Description": "A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case).", - "Type": { - "$id": "17", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": true, - "Decorators": [] - }, - { - "$id": "18", - "Name": "displayName", - "SerializedName": "displayName", - "Description": "The display name for the Pool. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.", - "Type": { - "$id": "19", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": true, - "Decorators": [] - }, - { - "$id": "20", - "Name": "url", - "SerializedName": "url", - "Description": "The URL of the Pool.", - "Type": { - "$id": "21", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": true, - "Decorators": [] - } - ] - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "22", - "Name": "odata.nextLink", - "SerializedName": "odata.nextLink", - "Description": "The URL to get the next set of results.", - "Type": { - "$id": "23", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$ref": "15" - }, - { - "$id": "24", - "Kind": "model", - "Name": "BatchError", - "CrossLanguageDefinitionId": "Pagination.BatchError", - "Usage": "Output,Error,Json", - "Description": "An error response received from the Azure Batch service.", - "Decorators": [], - "Properties": [ - { - "$id": "25", - "Name": "code", - "SerializedName": "code", - "Description": "An identifier for the error. Codes are invariant and are intended to be consumed programmatically.", - "Type": { - "$id": "26", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "27", - "Kind": "model", - "Name": "TextBlocklist", - "CrossLanguageDefinitionId": "Pagination.TextBlocklist", - "Usage": "Output,Json", - "Description": "Text Blocklist.", - "Decorators": [], - "Properties": [ - { - "$id": "28", - "Name": "blocklistName", - "SerializedName": "blocklistName", - "Description": "Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~", - "Type": { - "$id": "29", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "30", - "Name": "description", - "SerializedName": "description", - "Description": "Text blocklist description.", - "Type": { - "$id": "31", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "32", - "Kind": "model", - "Name": "TextBlockItem", - "CrossLanguageDefinitionId": "Pagination.TextBlockItem", - "Usage": "Output,Json", - "Description": "Item in TextBlocklist.", - "Decorators": [], - "Properties": [ - { - "$id": "33", - "Name": "blockItemId", - "SerializedName": "blockItemId", - "Description": "Block Item Id. It will be uuid.", - "Type": { - "$id": "34", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "35", - "Name": "description", - "SerializedName": "description", - "Description": "Block item description.", - "Type": { - "$id": "36", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "37", - "Name": "text", - "SerializedName": "text", - "Description": "Block item content.", - "Type": { - "$id": "38", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "39", - "Kind": "model", - "Name": "LedgerEntry", - "CrossLanguageDefinitionId": "Pagination.LedgerEntry", - "Usage": "Output,Json", - "Decorators": [], - "Properties": [ - { - "$id": "40", - "Name": "contents", - "SerializedName": "contents", - "Description": "Contents of the ledger entry.", - "Type": { - "$id": "41", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "42", - "Name": "collectionId", - "SerializedName": "collectionId", - "Description": "", - "Type": { - "$id": "43", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": true, - "Decorators": [] - }, - { - "$id": "44", - "Name": "transactionId", - "SerializedName": "transactionId", - "Description": "", - "Type": { - "$id": "45", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": true, - "Decorators": [] - } - ] - }, - { - "$id": "46", - "Kind": "model", - "Name": "DimensionValueListItem", - "CrossLanguageDefinitionId": "Pagination.DimensionValueListItem", - "Usage": "Output,Json", - "Decorators": [], - "Properties": [ - { - "$id": "47", - "Name": "value", - "SerializedName": "value", - "Description": "", - "Type": { - "$id": "48", - "Kind": "array", - "Name": "Array", - "ValueType": { - "$id": "49", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "50", - "Kind": "model", - "Name": "ListLedgerEntryInputBody", - "CrossLanguageDefinitionId": "Pagination.ListLedgerEntryInputBody", - "Usage": "Input,Json", - "Description": "Type for input model body", - "Decorators": [], - "Properties": [ - { - "$id": "51", - "Name": "requiredString", - "SerializedName": "requiredString", - "Description": "Required string", - "Type": { - "$id": "52", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "53", - "Name": "requiredInt", - "SerializedName": "requiredInt", - "Description": "Required int", - "Type": { - "$id": "54", - "Kind": "int32", - "Name": "int32", - "CrossLanguageDefinitionId": "TypeSpec.int32", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "55", - "Kind": "model", - "Name": "PagedLedgerEntries", - "CrossLanguageDefinitionId": "Pagination.PagedLedgerEntries", - "Usage": "Output,Json", - "Description": "Paginated ledger entries", - "Decorators": [], - "Properties": [ - { - "$id": "56", - "Name": "entries", - "SerializedName": "entries", - "Description": "Array of ledger entries", - "Type": { - "$id": "57", - "Kind": "array", - "Name": "ArrayLedgerEntry", - "ValueType": { - "$ref": "39" - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "58", - "Name": "customNextLink", - "SerializedName": "customNextLink", - "Description": "Path to retrieve next page of ledger entries", - "Type": { - "$id": "59", - "Kind": "url", - "Name": "ResourceLocation", - "CrossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", - "BaseType": { - "$id": "60", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url", - "Decorators": [] - }, - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "61", - "Kind": "model", - "Name": "PagedDimensionValueListItem", - "CrossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", - "Usage": "None", - "Description": "Paged collection of DimensionValueListItem items", - "Decorators": [], - "Properties": [ - { - "$id": "62", - "Name": "value", - "SerializedName": "value", - "Description": "The DimensionValueListItem items on this page", - "Type": { - "$id": "63", - "Kind": "array", - "Name": "ArrayDimensionValueListItem", - "ValueType": { - "$ref": "46" - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "64", - "Name": "nextLink", - "SerializedName": "nextLink", - "Description": "The link to the next page of items", - "Type": { - "$id": "65", - "Kind": "url", - "Name": "ResourceLocation", - "CrossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", - "BaseType": { - "$id": "66", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url", - "Decorators": [] - }, - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "67", - "Kind": "model", - "Name": "PagedLedgerEntry", - "CrossLanguageDefinitionId": "Azure.Core.Page", - "Usage": "None", - "Description": "Paged collection of LedgerEntry items", - "Decorators": [], - "Properties": [ - { - "$id": "68", - "Name": "value", - "SerializedName": "value", - "Description": "The LedgerEntry items on this page", - "Type": { - "$id": "69", - "Kind": "array", - "Name": "ArrayLedgerEntry", - "ValueType": { - "$ref": "39" - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "70", - "Name": "nextLink", - "SerializedName": "nextLink", - "Description": "The link to the next page of items", - "Type": { - "$id": "71", - "Kind": "url", - "Name": "ResourceLocation", - "CrossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", - "BaseType": { - "$id": "72", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url", - "Decorators": [] - }, - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "73", - "Kind": "model", - "Name": "PagedTextBlocklist", - "CrossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", - "Usage": "None", - "Description": "Paged collection of TextBlocklist items", - "Decorators": [], - "Properties": [ - { - "$id": "74", - "Name": "value", - "SerializedName": "value", - "Description": "The TextBlocklist items on this page", - "Type": { - "$id": "75", - "Kind": "array", - "Name": "ArrayTextBlocklist", - "ValueType": { - "$ref": "27" - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "76", - "Name": "nextLink", - "SerializedName": "nextLink", - "Description": "The link to the next page of items", - "Type": { - "$id": "77", - "Kind": "url", - "Name": "ResourceLocation", - "CrossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", - "BaseType": { - "$id": "78", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url", - "Decorators": [] - }, - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - }, - { - "$id": "79", - "Kind": "model", - "Name": "PagedTextBlockItem", - "CrossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", - "Usage": "None", - "Description": "Paged collection of TextBlockItem items", - "Decorators": [], - "Properties": [ - { - "$id": "80", - "Name": "value", - "SerializedName": "value", - "Description": "The TextBlockItem items on this page", - "Type": { - "$id": "81", - "Kind": "array", - "Name": "ArrayTextBlockItem", - "ValueType": { - "$ref": "32" - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "IsRequired": true, - "IsReadOnly": false, - "Decorators": [] - }, - { - "$id": "82", - "Name": "nextLink", - "SerializedName": "nextLink", - "Description": "The link to the next page of items", - "Type": { - "$id": "83", - "Kind": "url", - "Name": "ResourceLocation", - "CrossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", - "BaseType": { - "$id": "84", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url", - "Decorators": [] - }, - "Decorators": [] - }, - "IsRequired": false, - "IsReadOnly": false, - "Decorators": [] - } - ] - } - ], - "Clients": [ - { - "$id": "85", - "Name": "PaginationClient", - "Operations": [], - "Protocol": { - "$id": "86" - }, - "Parameters": [ - { - "$id": "87", - "Name": "pagnationUri", - "NameInRequest": "pagnationUri", - "Type": { - "$id": "88", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url" - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - } - ], - "Decorators": [] - }, - { - "$id": "89", - "Name": "Pagination", - "Operations": [ - { - "$id": "90", - "Name": "ListPaginationLedgerEntries", - "ResourceName": "LedgerEntry", - "Summary": "Gets ledger entries from a collection corresponding to a range.", - "Description": "A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned.", - "Accessibility": "public", - "Parameters": [ - { - "$id": "91", - "Name": "pagnationUri", - "NameInRequest": "pagnationUri", - "Type": { - "$id": "92", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url" - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - }, - { - "$id": "93", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "The API version to use for this operation.", - "Type": { - "$id": "94", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Client", - "DefaultValue": { - "$id": "95", - "Type": { - "$id": "96", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string" - }, - "Value": "2022-05-13" - }, - "Decorators": [] - }, - { - "$id": "97", - "Name": "contentType", - "NameInRequest": "Content-Type", - "Description": "Body parameter's content type. Known values are application/json", - "Type": { - "$id": "98", - "Kind": "constant", - "ValueType": { - "$id": "99", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": true, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - }, - { - "$id": "100", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "101", - "Kind": "constant", - "ValueType": { - "$id": "102", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - }, - { - "$id": "103", - "Name": "bodyInput", - "NameInRequest": "bodyInput", - "Description": "Body parameter", - "Type": { - "$ref": "50" - }, - "Location": "Body", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Method", - "Decorators": [] - } - ], - "Responses": [ - { - "$id": "104", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "55" - }, - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false, - "ContentTypes": [ - "application/json" - ] - } - ], - "HttpMethod": "GET", - "RequestBodyMediaType": "Json", - "Uri": "{pagnationUri}", - "Path": "/app/transactions", - "RequestMediaTypes": [ - "application/json" - ], - "BufferResponse": true, - "Paging": { - "$id": "105", - "ItemName": "entries", - "NextLinkName": "customNextLink" - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true, - "CrossLanguageDefinitionId": "Pagination.Pagination.ListPaginationLedgerEntries", - "Decorators": [] - } - ], - "Protocol": { - "$id": "106" - }, - "Parent": "PaginationClient", - "Parameters": [ - { - "$ref": "91" - } - ], - "Decorators": [] - }, - { - "$id": "107", - "Name": "AdditionalParameter", - "Operations": [ - { - "$id": "108", - "Name": "ListMetricDimensionValues", - "ResourceName": "DimensionValueListItem", - "Summary": "List the dimension values for the given metric dimension name.", - "Description": "List the dimension values for the given metric dimension name.", - "Accessibility": "public", - "Parameters": [ - { - "$id": "109", - "Name": "pagnationUri", - "NameInRequest": "pagnationUri", - "Type": { - "$id": "110", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url" - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - }, - { - "$id": "111", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "The API version to use for this operation.", - "Type": { - "$id": "112", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Client", - "DefaultValue": { - "$id": "113", - "Type": { - "$id": "114", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string" - }, - "Value": "2022-05-13" - }, - "Decorators": [] - }, - { - "$id": "115", - "Name": "testRunId", - "NameInRequest": "testRunId", - "Description": "Unique test run name as identifier", - "Type": { - "$id": "116", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Path", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "117", - "Name": "name", - "NameInRequest": "name", - "Description": "Dimension name", - "Type": { - "$id": "118", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Path", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "119", - "Name": "interval", - "NameInRequest": "interval", - "Description": "The interval (i.e. timegrain) of the query.", - "Type": { - "$ref": "2" - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "120", - "Name": "metricName", - "NameInRequest": "metricName", - "Description": "Metric name", - "Type": { - "$id": "121", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "122", - "Name": "metricNamespace", - "NameInRequest": "metricNamespace", - "Description": "Metric namespace to query metric definitions for.", - "Type": { - "$id": "123", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "124", - "Name": "timespan", - "NameInRequest": "timespan", - "Description": "The timespan of the query. It is a string with the following format\n'startDateTime_ISO/endDateTime_ISO'.", - "Type": { - "$id": "125", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "126", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "127", - "Kind": "constant", - "ValueType": { - "$id": "128", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - } - ], - "Responses": [ - { - "$id": "129", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "61" - }, - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false, - "ContentTypes": [ - "application/json" - ] - } - ], - "HttpMethod": "GET", - "RequestBodyMediaType": "None", - "Uri": "{pagnationUri}", - "Path": "/test-runs/{testRunId}/metric-dimensions/{name}/values", - "BufferResponse": true, - "Paging": { - "$id": "130", - "ItemName": "value", - "NextLinkName": "nextLink" - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true, - "CrossLanguageDefinitionId": "Pagination.AdditionalParameter.ListMetricDimensionValues", - "Decorators": [] - } - ], - "Protocol": { - "$id": "131" - }, - "Parent": "PaginationClient", - "Parameters": [ - { - "$ref": "109" - } - ], - "Decorators": [] - }, - { - "$id": "132", - "Name": "UseFoundationsResourceList", - "Operations": [ - { - "$id": "133", - "Name": "list", - "ResourceName": "LedgerEntry", - "Description": "List upload detail for the discovery resource.", - "Accessibility": "public", - "Parameters": [ - { - "$id": "134", - "Name": "pagnationUri", - "NameInRequest": "pagnationUri", - "Type": { - "$id": "135", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url" - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - }, - { - "$id": "136", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "The API version to use for this operation.", - "Type": { - "$id": "137", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Client", - "DefaultValue": { - "$id": "138", - "Type": { - "$id": "139", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string" - }, - "Value": "2022-05-13" - }, - "Decorators": [] - }, - { - "$id": "140", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "141", - "Kind": "constant", - "ValueType": { - "$id": "142", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - } - ], - "Responses": [ - { - "$id": "143", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "67" - }, - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false, - "ContentTypes": [ - "application/json" - ] - } - ], - "HttpMethod": "GET", - "RequestBodyMediaType": "None", - "Uri": "{pagnationUri}", - "Path": "/adp/transactions", - "BufferResponse": true, - "Paging": { - "$id": "144", - "ItemName": "value", - "NextLinkName": "nextLink" - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true, - "CrossLanguageDefinitionId": "Pagination.UseFoundationsResourceList.list", - "Decorators": [] - } - ], - "Protocol": { - "$id": "145" - }, - "Parent": "PaginationClient", - "Parameters": [ - { - "$ref": "134" - } - ], - "Decorators": [] - }, - { - "$id": "146", - "Name": "TwoTypesItem", - "Operations": [ - { - "$id": "147", - "Name": "listTextBlocklists", - "ResourceName": "TextBlocklist", - "Summary": "Get All Text Blocklists", - "Description": "Get all text blocklists details.", - "Accessibility": "public", - "Parameters": [ - { - "$id": "148", - "Name": "pagnationUri", - "NameInRequest": "pagnationUri", - "Type": { - "$id": "149", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url" - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - }, - { - "$id": "150", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "The API version to use for this operation.", - "Type": { - "$id": "151", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Client", - "DefaultValue": { - "$id": "152", - "Type": { - "$id": "153", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string" - }, - "Value": "2022-05-13" - }, - "Decorators": [] - }, - { - "$id": "154", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "155", - "Kind": "constant", - "ValueType": { - "$id": "156", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - } - ], - "Responses": [ - { - "$id": "157", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "73" - }, - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false, - "ContentTypes": [ - "application/json" - ] - } - ], - "HttpMethod": "GET", - "RequestBodyMediaType": "None", - "Uri": "{pagnationUri}", - "Path": "/text/blocklists", - "BufferResponse": true, - "Paging": { - "$id": "158", - "ItemName": "value", - "NextLinkName": "nextLink" - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true, - "CrossLanguageDefinitionId": "Pagination.TwoTypesItem.listTextBlocklists", - "Decorators": [] - }, - { - "$id": "159", - "Name": "listTextBlocklistItems", - "ResourceName": "TextBlockItem", - "Summary": "Get All BlockItems By blocklistName", - "Description": "Get all blockItems in a text blocklist", - "Accessibility": "public", - "Parameters": [ - { - "$ref": "148" - }, - { - "$id": "160", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "The API version to use for this operation.", - "Type": { - "$id": "161", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Client", - "DefaultValue": { - "$id": "162", - "Type": { - "$id": "163", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string" - }, - "Value": "2022-05-13" - }, - "Decorators": [] - }, - { - "$id": "164", - "Name": "blocklistName", - "NameInRequest": "blocklistName", - "Description": "Text blocklist name. Only supports the following characters: 0-9 A-Z a-z - . _ ~", - "Type": { - "$id": "165", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Path", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "166", - "Name": "top", - "NameInRequest": "top", - "Description": "The number of result items to return.", - "Type": { - "$id": "167", - "Kind": "int32", - "Name": "int32", - "CrossLanguageDefinitionId": "TypeSpec.int32", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "168", - "Name": "skip", - "NameInRequest": "skip", - "Description": "The number of result items to skip.", - "Type": { - "$id": "169", - "Kind": "int32", - "Name": "int32", - "CrossLanguageDefinitionId": "TypeSpec.int32", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "170", - "Name": "maxpagesize", - "NameInRequest": "maxpagesize", - "Description": "The maximum number of result items per page.", - "Type": { - "$id": "171", - "Kind": "int32", - "Name": "int32", - "CrossLanguageDefinitionId": "TypeSpec.int32", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "172", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "173", - "Kind": "constant", - "ValueType": { - "$id": "174", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - } - ], - "Responses": [ - { - "$id": "175", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "79" - }, - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false, - "ContentTypes": [ - "application/json" - ] - } - ], - "HttpMethod": "GET", - "RequestBodyMediaType": "None", - "Uri": "{pagnationUri}", - "Path": "/text/blocklists/{blocklistName}/blockItems", - "BufferResponse": true, - "Paging": { - "$id": "176", - "ItemName": "value", - "NextLinkName": "nextLink" - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true, - "CrossLanguageDefinitionId": "Pagination.TwoTypesItem.listTextBlocklistItems", - "Decorators": [] - } - ], - "Protocol": { - "$id": "177" - }, - "Parent": "PaginationClient", - "Parameters": [ - { - "$ref": "148" - } - ], - "Decorators": [] - }, - { - "$id": "178", - "Name": "Pools", - "Operations": [ - { - "$id": "179", - "Name": "listPools", - "ResourceName": "Pools", - "Description": "Lists all of the Pools in the specified Account.", - "Accessibility": "public", - "Parameters": [ - { - "$id": "180", - "Name": "pagnationUri", - "NameInRequest": "pagnationUri", - "Type": { - "$id": "181", - "Kind": "url", - "Name": "url", - "CrossLanguageDefinitionId": "TypeSpec.url" - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - }, - { - "$id": "182", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "The API version to use for this operation.", - "Type": { - "$id": "183", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Client", - "DefaultValue": { - "$id": "184", - "Type": { - "$id": "185", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string" - }, - "Value": "2022-05-13" - }, - "Decorators": [] - }, - { - "$id": "186", - "Name": "$filter", - "NameInRequest": "$filter", - "Description": "An OData $filter clause. For more information on constructing this filter, see\nhttps://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools.", - "Type": { - "$id": "187", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "188", - "Name": "$select", - "NameInRequest": "$select", - "Description": "An OData $select clause.", - "Type": { - "$id": "189", - "Kind": "array", - "Name": "Array", - "ValueType": { - "$id": "190", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "ArraySerializationDelimiter": ",", - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "191", - "Name": "$expand", - "NameInRequest": "$expand", - "Description": "An OData $expand clause.", - "Type": { - "$id": "192", - "Kind": "array", - "Name": "Array", - "ValueType": { - "$id": "193", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "CrossLanguageDefinitionId": "TypeSpec.Array", - "Decorators": [] - }, - "Location": "Query", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "ArraySerializationDelimiter": ",", - "IsRequired": false, - "Kind": "Method", - "Decorators": [] - }, - { - "$id": "194", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "195", - "Kind": "constant", - "ValueType": { - "$id": "196", - "Kind": "string", - "Name": "string", - "CrossLanguageDefinitionId": "TypeSpec.string", - "Decorators": [] - }, - "Value": "application/json", - "Decorators": [] - }, - "Location": "Header", - "IsApiVersion": false, - "IsContentType": false, - "IsEndpoint": false, - "Explode": false, - "IsRequired": true, - "Kind": "Constant", - "Decorators": [] - } - ], - "Responses": [ - { - "$id": "197", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "12" - }, - "BodyMediaType": "Json", - "Headers": [], - "IsErrorResponse": false, - "ContentTypes": [ - "application/json" - ] - } - ], - "HttpMethod": "GET", - "RequestBodyMediaType": "None", - "Uri": "{pagnationUri}", - "Path": "/pools", - "BufferResponse": true, - "Paging": { - "$id": "198", - "ItemName": "value", - "NextLinkName": "odata.nextLink" - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true, - "CrossLanguageDefinitionId": "Pagination.Pools.listPools", - "Decorators": [] - } - ], - "Protocol": { - "$id": "199" - }, - "Parent": "PaginationClient", - "Parameters": [ - { - "$ref": "180" - } - ], - "Decorators": [] - } - ], - "Auth": { - "$id": "200", - "OAuth2": { - "$id": "201", - "Scopes": [ - "https://pagination.azure.com/.default" - ] - } - } -} diff --git a/test/TestProjects/Pagination-TypeSpec/tspconfig.yaml b/test/TestProjects/Pagination-TypeSpec/tspconfig.yaml deleted file mode 100644 index ebef0c6e79b..00000000000 --- a/test/TestProjects/Pagination-TypeSpec/tspconfig.yaml +++ /dev/null @@ -1,3 +0,0 @@ -options: - "@azure-tools/typespec-csharp": - flavor: "azure"