From 6c15cd0c8d49bad5e0ddadee48820d5c558815ab Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Thu, 1 Jul 2021 13:48:11 +0800 Subject: [PATCH] LLC Paging (#1061) * [Automation] Report * [Automation] Report * [Automation] Report * Paging * PagingAsync * PagingAsync method * ProtocolSyncPagingMethodTemplate * PagingAsync method done * ProtocolAsyncPagingSinglePageMethodTemplate * log * Filter group parameters in low level client methods, from https://github.com/Azure/autorest.java/pull/1062 * mapper, return type, paging method template * Add imports for protocol paging * PagingHelperMethods * Fix a small issue * client, wrapper methods * Paging test * module-info.java * Remove stale code * style * Helper methods for paging * Upgrade to Junit 5 * Add rawNextLinkName * Add rawItemName; test * test * fix * Robust code Co-authored-by: Github Actions --- fluent-tests/report.md | 87 +- .../autorest/mapper/ClientMethodMapper.java | 35 +- .../model/clientmodel/ClientMethod.java | 11 + .../model/clientmodel/MethodPageDetails.java | 21 +- .../template/ClientMethodTemplate.java | 127 +- .../template/MethodGroupTemplate.java | 28 +- .../autorest/template/TemplateFactory.java | 1 - .../template/WrapperClientMethodTemplate.java | 120 +- .../protocol/ProtocolAsyncClientTemplate.java | 5 + protocol-tests/pom.xml | 6 +- .../AutoRestPagingTestServiceAsyncClient.java | 790 ++++ .../AutoRestPagingTestServiceBuilder.java | 229 ++ .../AutoRestPagingTestServiceClient.java | 547 +++ .../AutoRestPagingTestServiceImpl.java | 98 + .../paging/implementation/PagingsImpl.java | 3486 +++++++++++++++++ .../java/fixtures/paging/package-info.java | 2 + protocol-tests/src/main/java/module-info.java | 4 +- .../bodystring/EnumOperationsTests.java | 14 +- .../bodystring/StringOperationsTests.java | 36 +- .../java/fixtures/paging/PagingTests.java | 158 + 20 files changed, 5596 insertions(+), 209 deletions(-) create mode 100644 protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceAsyncClient.java create mode 100644 protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceBuilder.java create mode 100644 protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceClient.java create mode 100644 protocol-tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java create mode 100644 protocol-tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java create mode 100644 protocol-tests/src/main/java/fixtures/paging/package-info.java create mode 100644 protocol-tests/src/test/java/fixtures/paging/PagingTests.java diff --git a/fluent-tests/report.md b/fluent-tests/report.md index 8bca9ccc07..c33cfb556a 100644 --- a/fluent-tests/report.md +++ b/fluent-tests/report.md @@ -1,8 +1,8 @@ # Java Codegen Report -Generated at 2021-06-03T20:13:30.025703 +Generated at 2021-06-06T19:52:05.572209 ## Success
-RP count: 175 +RP count: 174 - EnterpriseKnowledgeGraph - addons @@ -155,7 +155,6 @@ Generated at 2021-06-03T20:13:30.025703 - servicefabricmanagedclusters - servicefabricmesh - signalr -- sql - sqlvirtualmachine - storSimple1200Series - storage @@ -200,7 +199,7 @@ Generated at 2021-06-03T20:13:30.025703 **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -249,8 +248,8 @@ FATAL: Error: Name is empty! [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ -[INFO] Total time: 6.325 s -[INFO] Finished at: 2021-06-03T18:59:15Z +[INFO] Total time: 6.038 s +[INFO] Finished at: 2021-06-06T18:38:48Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project azure-resourcemanager-automation: Compilation failure: Compilation failure: [ERROR] /home/runner/work/autorest.java/autorest.java/fluent_generated/azure-resourcemanager-automation/src/main/java/com/azure/resourcemanager/automation/fluent/DscConfigurationsClient.java:[201,27] method update(java.lang.String,java.lang.String,java.lang.String) is already defined in interface com.azure.resourcemanager.automation.fluent.DscConfigurationsClient @@ -276,7 +275,7 @@ FATAL: Error: Name is empty! **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -950,7 +949,7 @@ INFORMATION (FluentJavaSettings): Option, string, pom-file : null INFORMATION (FluentJavaSettings): Option, string, package-version : null INFORMATION (FluentJavaSettings): Option, boolean, sdk-integration : null INFORMATION (FluentGen): Map code model to client model -INFORMATION (FluentMapper): Add Inner to response types: [Operation, DataFlowResource, IntegrationRuntimeConnectionInfo, PipelineRunsQueryResponse, IntegrationRuntimeMonitoringData, PipelineRun, IntegrationRuntimeResource, SelfHostedIntegrationRuntimeNode, LinkedServiceResource, IntegrationRuntimeNodeIpAddress, TriggerResource, IntegrationRuntimeStatusResponse, IntegrationRuntimeAuthKeys, TriggerSubscriptionOperationStatus, GitHubAccessTokenResponse, ExposureControlBatchResponse, SsisObjectMetadataStatusResponse, TriggerRunsQueryResponse, ActivityRunsQueryResponse, PipelineResource, DataFlowDebugCommandResponse, PrivateLinkResourcesWrapper, AddDataFlowToDebugSessionResponse, DatasetResource, Factory, AccessPolicyResponse, SsisObjectMetadataListResponse, DataFlowDebugSessionInfo, CreateDataFlowDebugSessionResponse, PrivateEndpointConnectionResource, ExposureControlResponse, ManagedVirtualNetworkResource, CreateRunResponse, TriggerQueryResponse, ManagedPrivateEndpointResource] +INFORMATION (FluentMapper): Add Inner to response types: [IntegrationRuntimeMonitoringData, ActivityRunsQueryResponse, TriggerSubscriptionOperationStatus, GitHubAccessTokenResponse, IntegrationRuntimeResource, PrivateLinkResourcesWrapper, TriggerResource, CreateDataFlowDebugSessionResponse, PrivateEndpointConnectionResource, ExposureControlBatchResponse, SelfHostedIntegrationRuntimeNode, AccessPolicyResponse, ManagedPrivateEndpointResource, DataFlowDebugSessionInfo, PipelineRun, CreateRunResponse, TriggerQueryResponse, SsisObjectMetadataListResponse, DatasetResource, SsisObjectMetadataStatusResponse, LinkedServiceResource, DataFlowDebugCommandResponse, IntegrationRuntimeNodeIpAddress, PipelineResource, DataFlowResource, ExposureControlResponse, IntegrationRuntimeConnectionInfo, TriggerRunsQueryResponse, IntegrationRuntimeAuthKeys, Operation, PipelineRunsQueryResponse, IntegrationRuntimeStatusResponse, AddDataFlowToDebugSessionResponse, Factory, ManagedVirtualNetworkResource] ``` **stderr** @@ -1020,7 +1019,7 @@ java.lang.IllegalArgumentException: discriminator not found in type ManagedVirtu **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1218,7 +1217,7 @@ java.lang.IllegalArgumentException: [JavaCheck/SchemaError] item name value not **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1242,7 +1241,7 @@ Use --help to get help information. **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1456,8 +1455,8 @@ java.lang.NullPointerException [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ -[INFO] Total time: 3.453 s -[INFO] Finished at: 2021-06-03T19:45:42Z +[INFO] Total time: 3.382 s +[INFO] Finished at: 2021-06-06T19:26:42Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project azure-resourcemanager-purview: Compilation failure: Compilation failure: [ERROR] /home/runner/work/autorest.java/autorest.java/fluent_generated/azure-resourcemanager-purview/src/main/java/com/azure/resourcemanager/purview/models/AccountPropertiesSystemData.java:[14,56] cannot inherit from final com.azure.core.management.SystemData @@ -1484,7 +1483,7 @@ java.lang.NullPointerException **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1541,7 +1540,7 @@ INFORMATION (FluentJavaSettings): Option, string, pom-file : null INFORMATION (FluentJavaSettings): Option, string, package-version : null INFORMATION (FluentJavaSettings): Option, boolean, sdk-integration : null INFORMATION (FluentGen): Map code model to client model -INFORMATION (FluentMapper): Add Inner to response types: [CalculatePriceResponse, Catalog, QuotaRequestOneResourceSubmitResponse, ExchangeOperationResultResponse, AppliedReservations, ReservationOrderResponse, QuotaRequestDetails, AvailableScopeProperties, CurrentQuotaLimitBase, OperationResponse, CalculateExchangeOperationResultResponse, QuotaRequestSubmitResponse201, ReservationResponse] +INFORMATION (FluentMapper): Add Inner to response types: [AppliedReservations, ReservationOrderResponse, CalculatePriceResponse, CurrentQuotaLimitBase, ExchangeOperationResultResponse, Catalog, QuotaRequestDetails, QuotaRequestSubmitResponse201, CalculateExchangeOperationResultResponse, OperationResponse, AvailableScopeProperties, ReservationResponse, QuotaRequestOneResourceSubmitResponse] ``` **stderr** @@ -1609,7 +1608,7 @@ java.lang.NullPointerException **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1633,7 +1632,7 @@ Use --help to get help information. **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1824,7 +1823,7 @@ INFORMATION (FluentJavaSettings): Option, string, pom-file : null INFORMATION (FluentJavaSettings): Option, string, package-version : null INFORMATION (FluentJavaSettings): Option, boolean, sdk-integration : null INFORMATION (FluentGen): Map code model to client model -INFORMATION (FluentMapper): Add Inner to response types: [IotSensorsList, IotAlertModel, AlertsSuppressionRule, Software, IoTSecurityAggregatedRecommendation, ConnectionStrings, Compliance, PricingList, AdvancedThreatProtectionSetting, Automation, RegulatoryComplianceAssessment, AdaptiveNetworkHardening, ConnectorSetting, IoTSecuritySolutionAnalyticsModel, RegulatoryComplianceControl, ServerVulnerabilityAssessmentsList, OnPremiseIotSensor, SecurityTask, InformationProtectionPolicy, ComplianceResult, RulesResults, OnPremiseIotSensorsList, Scans, ExternalSecuritySolution, IotRecommendation, SecurityAssessmentMetadata, PackageDownloads, Alert, SecurityAssessment, AllowedConnectionsResource, RuleResults, SecuritySolutionsReferenceDataList, IngestionSetting, IotRecommendationType, AscLocation, JitNetworkAccessRequest, IngestionSettingToken, IotSitesList, AdaptiveApplicationControlGroup, SecuritySubAssessment, Device, ScanResult, IotDefenderSettingsList, IoTSecurityAggregatedAlert, AutomationValidationStatus, IotSensorsModel, Operation, IotAlertTypeList, IotAlert, JitNetworkAccessPolicy, ServerVulnerabilityAssessment, IotDefenderSettingsModel, Pricing, DiscoveredSecuritySolution, DeviceSecurityGroup, SecurityContact, IotRecommendationTypeList, IotAlertType, WorkspaceSetting, IotSitesModel, SecureScoreItem, IoTSecuritySolutionModel, Setting, IotRecommendationModel, SecuritySolution, TopologyResource, SecureScoreControlDetails, AutoProvisioningSetting, RegulatoryComplianceStandard, AdaptiveApplicationControlGroups, ScanResults, IoTSecuritySolutionAnalyticsModelList, Scan, SecureScoreControlDefinitionItem] +INFORMATION (FluentMapper): Add Inner to response types: [IotRecommendationModel, AscLocation, Alert, IotDefenderSettingsList, AdaptiveNetworkHardening, SecureScoreControlDetails, ServerVulnerabilityAssessment, DiscoveredSecuritySolution, Compliance, Scans, RegulatoryComplianceAssessment, ConnectionStrings, RegulatoryComplianceControl, IngestionSetting, WorkspaceSetting, IotRecommendationType, IotSensorsList, SecuritySolutionsReferenceDataList, AutomationValidationStatus, RuleResults, InformationProtectionPolicy, RegulatoryComplianceStandard, IotAlertTypeList, IoTSecuritySolutionAnalyticsModel, AutoProvisioningSetting, IotAlertModel, AllowedConnectionsResource, AdvancedThreatProtectionSetting, SecureScoreControlDefinitionItem, SecurityAssessmentMetadata, ExternalSecuritySolution, Device, IoTSecuritySolutionModel, PricingList, SecureScoreItem, Scan, PackageDownloads, OnPremiseIotSensorsList, SecurityTask, Automation, IotSensorsModel, Software, IotSitesList, Pricing, IoTSecurityAggregatedAlert, ScanResult, IotDefenderSettingsModel, IotRecommendationTypeList, SecurityContact, AdaptiveApplicationControlGroups, SecuritySolution, JitNetworkAccessRequest, DeviceSecurityGroup, AdaptiveApplicationControlGroup, Operation, IoTSecuritySolutionAnalyticsModelList, ScanResults, OnPremiseIotSensor, ComplianceResult, TopologyResource, ConnectorSetting, SecurityAssessment, IngestionSettingToken, IotSitesModel, IotAlertType, ServerVulnerabilityAssessmentsList, RulesResults, Setting, IoTSecurityAggregatedRecommendation, AlertsSuppressionRule, IotAlert, SecuritySubAssessment, IotRecommendation, JitNetworkAccessPolicy] INFORMATION (FluentMapper): Add Inner for type 'SecureScoreControlDefinitionItem': [] ``` @@ -1897,7 +1896,7 @@ java.lang.IllegalArgumentException: discriminator not found in type ExternalSecu **stdout** ``` -AutoRest code generation utility [cli version: 3.2.1; node: v14.17.0, max-memory: 2048 MB] +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) @@ -1912,12 +1911,6 @@ INFORMATION: > Loading local AutoRest extension '@autorest/java.fluent' (/home/r INFORMATION: > Loading local AutoRest extension '@autorest/java.fluentnamer' (/home/runner/work/autorest.java/autorest.java/fluentgen/../fluentnamer) INFORMATION: > Loading AutoRest extension '@autorest/modelerfour' (4.18.1->4.18.1) -WARNING (PostOperationIdContainsUrlVerb/R2066/SDKViolation): OperationId should contain the verb: 'generatemap' in:'Maps_Generate'. Consider updating the operationId - - file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json:4591:4 - -WARNING (PostOperationIdContainsUrlVerb/R2066/SDKViolation): OperationId should contain the verb: 'machinegroups' in:'MachineGroups_Create'. Consider updating the operationId - - file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json:6557:4 - WARNING (PreCheck/SchemaMissingType): The schema 'Resource' with an undefined type and declared properties is a bit ambigious. This has been auto-corrected to 'type:object' WARNING (PreCheck/SchemaMissingType): The schema 'ResourceReference' with an undefined type and declared properties is a bit ambigious. This has been auto-corrected to 'type:object' @@ -2014,6 +2007,12 @@ WARNING (PreCheck/CheckDuplicateSchemas): Checking for duplicate schemas, this c WARNING (PreCheck/PropertyRedeclarationWarning): Schema 'MachineGroup' has a property 'etag' that is already declared the parent schema 'CoreResource' but isn't significantly different. The property has been removed from MachineGroup +WARNING (PostOperationIdContainsUrlVerb/R2066/SDKViolation): OperationId should contain the verb: 'generatemap' in:'Maps_Generate'. Consider updating the operationId + - file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json:4591:4 + +WARNING (PostOperationIdContainsUrlVerb/R2066/SDKViolation): OperationId should contain the verb: 'machinegroups' in:'MachineGroups_Create'. Consider updating the operationId + - file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json:6557:4 + WARNING (EnumInsteadOfBoolean/R3018/ARMViolation): Booleans are not descriptive and make them hard to use. Consider using string enums with allowed set of values defined. Property: live - file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json:58:6 @@ -2103,7 +2102,7 @@ INFORMATION (FluentJavaSettings): Option, string, pom-file : null INFORMATION (FluentJavaSettings): Option, string, package-version : null INFORMATION (FluentJavaSettings): Option, boolean, sdk-integration : null INFORMATION (FluentGen): Map code model to client model -INFORMATION (FluentMapper): Add Inner to response types: [Liveness, Connection, Machine, MapResponse, Process, Port, ClientGroupMember, ClientGroup, MachineGroup, MachinesSummary, ClientGroupMembersCount] +INFORMATION (FluentMapper): Add Inner to response types: [Machine, Connection, Liveness, ClientGroup, ClientGroupMembersCount, Process, Port, MachineGroup, MapResponse, ClientGroupMember, MachinesSummary] INFORMATION (FluentGen): Java template for client model INFORMATION (FluentGen): Process for Fluent Lite, SDK integration disabled INFORMATION (FluentJavaSettings): Option, string, tag : package-2015-11-preview @@ -2122,12 +2121,12 @@ INFORMATION (FluentGen): Write Text ``` FATAL: Failed validating: 'file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json', error encountered: TypeError: Cannot read property 'properties' of undefined FATAL: [object Object] -(node:24570) UnhandledPromiseRejectionWarning: Error: Plugin model-validator reported failure. +(node:24890) UnhandledPromiseRejectionWarning: Error: Plugin model-validator reported failure. at /home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist/src_lib_autorest-core_ts.js:3015:19 at ScheduleNode (/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist/src_lib_autorest-core_ts.js:1809:33) (Use `node --trace-warnings ...` to show where the warning was created) -(node:24570) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 60) -(node:24570) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. +(node:24890) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 60) +(node:24890) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ERROR (DeleteOperationResponses/R4011/ARMViolation): The delete operation is defined without a 200 or 204 error response implementation,please add it.' - file:///home/runner/work/autorest.java/autorest.java/azure-rest-api-specs/specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/arm-service-map.json:6869:4 @@ -2201,8 +2200,8 @@ ERROR (DeleteOperationResponses/R4011/ARMViolation): The delete operation is def [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ -[INFO] Total time: 4.250 s -[INFO] Finished at: 2021-06-03T19:55:14Z +[INFO] Total time: 4.295 s +[INFO] Finished at: 2021-06-06T19:36:41Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project azure-resourcemanager-servicefabric: Compilation failure: Compilation failure: [ERROR] /home/runner/work/autorest.java/autorest.java/fluent_generated/azure-resourcemanager-servicefabric/src/main/java/com/azure/resourcemanager/servicefabric/fluent/OperationsClient.java:[45,41] method list() is already defined in interface com.azure.resourcemanager.servicefabric.fluent.OperationsClient @@ -2375,8 +2374,8 @@ ERROR (DeleteOperationResponses/R4011/ARMViolation): The delete operation is def [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ -[INFO] Total time: 3.175 s -[INFO] Finished at: 2021-06-03T19:56:38Z +[INFO] Total time: 3.072 s +[INFO] Finished at: 2021-06-06T19:38:05Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project azure-resourcemanager-softwareplan: Compilation failure: Compilation failure: [ERROR] /home/runner/work/autorest.java/autorest.java/fluent_generated/azure-resourcemanager-softwareplan/src/main/java/com/azure/resourcemanager/softwareplan/implementation/HybridUseBenefitsImpl.java:[72,49] method list(java.lang.String) is already defined in class com.azure.resourcemanager.softwareplan.implementation.HybridUseBenefitsImpl @@ -2484,6 +2483,24 @@ ERROR (DeleteOperationResponses/R4011/ARMViolation): The delete operation is def ```
+
+sql + +**stdout** +``` +AutoRest code generation utility [cli version: 3.2.3; node: v14.17.0, max-memory: 2048 MB] +(C) 2018 Microsoft Corporation. +https://aka.ms/autorest + Loading AutoRest core '/home/runner/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3) + +``` +**stderr** +``` + Error: Unable to acquire exclusive lock on '_home_runner_.autorest.busy-lock' before timeout 20000 msec. + +``` +
+
visualstudio @@ -2522,8 +2539,8 @@ ERROR (DeleteOperationResponses/R4011/ARMViolation): The delete operation is def [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ -[INFO] Total time: 1.951 s -[INFO] Finished at: 2021-06-03T20:07:44Z +[INFO] Total time: 1.916 s +[INFO] Finished at: 2021-06-06T19:45:58Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project azure-resourcemanager-visualstudio: Compilation failure: Compilation failure: [ERROR] /home/runner/work/autorest.java/autorest.java/fluent_generated/azure-resourcemanager-visualstudio/src/main/java/com/azure/resourcemanager/visualstudio/models/AccountResourceRequestOperationType.java:[13,50] expected diff --git a/javagen/src/main/java/com/azure/autorest/mapper/ClientMethodMapper.java b/javagen/src/main/java/com/azure/autorest/mapper/ClientMethodMapper.java index 1f9f4f9ce5..dfab64a344 100644 --- a/javagen/src/main/java/com/azure/autorest/mapper/ClientMethodMapper.java +++ b/javagen/src/main/java/com/azure/autorest/mapper/ClientMethodMapper.java @@ -79,9 +79,15 @@ public List map(Operation operation) { } IType listType = itemPropertyOpt.get().getWireType(); IType elementType = ((ListType) listType).getElementType(); - asyncRestResponseReturnType = createPagedRestResponseReturnType(elementType); - asyncReturnType = createPagedAsyncReturnType(elementType); - syncReturnType = createPagedSyncReturnType(elementType); + if (settings.isLowLevelClient()) { + asyncRestResponseReturnType = createProtocolPagedRestResponseReturnType(); + asyncReturnType = createProtocolPagedAsyncReturnType(); + syncReturnType = createProtocolPagedSyncReturnType(); + } else { + asyncRestResponseReturnType = createPagedRestResponseReturnType(elementType); + asyncReturnType = createPagedAsyncReturnType(elementType); + syncReturnType = createPagedSyncReturnType(elementType); + } } else { asyncRestResponseReturnType = null; IType responseBodyType = SchemaUtil.getOperationResponseType(operation); @@ -128,6 +134,9 @@ public List map(Operation operation) { if (settings.isLowLevelClient()) { codeModelParameters = request.getParameters().stream().filter(p -> p.isRequired() && !(p.getSchema().getType() == Schema.AllSchemaTypes.GROUP)).collect(Collectors.toList()); +// Only path param is allowed +// codeModelParameters = request.getParameters().stream().filter( +// p -> p.getProtocol().getHttp().getIn() == RequestParameterLocation.Path).collect(Collectors.toList()); } else { codeModelParameters = request.getParameters().stream().filter(p -> !p.isFlattened()).collect(Collectors.toList()); } @@ -247,7 +256,9 @@ && shouldGeneratePagingMethods()) { CodeNamer.getPropertyName(operation.getExtensions().getXmsPageable().getNextLinkName()), pageableItemName, (nextMethods == null) ? null : nextMethods.stream().findFirst().get(), - lroIntermediateType); + lroIntermediateType, + operation.getExtensions().getXmsPageable().getNextLinkName(), + operation.getExtensions().getXmsPageable().getItemName()); builder.methodPageDetails(details); if (!(!settings.getRequiredParameterClientMethods() && settings.isContextClientMethodParameter() @@ -295,7 +306,9 @@ && shouldGeneratePagingMethods()) { nextMethods.stream() .filter(m -> m.getType() == ClientMethodType.PagingAsyncSinglePage) .filter(m -> m.getMethodParameters().stream().anyMatch(p -> getContextType().equals(p.getClientType()))).findFirst().get(), - lroIntermediateType); + lroIntermediateType, + operation.getExtensions().getXmsPageable().getNextLinkName(), + operation.getExtensions().getXmsPageable().getItemName()); } addClientMethodWithContext(methods, @@ -621,6 +634,18 @@ protected IType createPagedRestResponseReturnType(IType elementType) { return GenericType.Mono(GenericType.PagedResponse(elementType)); } + protected IType createProtocolPagedSyncReturnType() { + return GenericType.PagedIterable(ClassType.BinaryData); + } + + protected IType createProtocolPagedAsyncReturnType() { + return GenericType.PagedFlux(ClassType.BinaryData); + } + + protected IType createProtocolPagedRestResponseReturnType() { + return GenericType.Mono(GenericType.PagedResponse(ClassType.BinaryData)); + } + protected ClientMethod.Builder getClientMethodBuilder() { return new ClientMethod.Builder(); } diff --git a/javagen/src/main/java/com/azure/autorest/model/clientmodel/ClientMethod.java b/javagen/src/main/java/com/azure/autorest/model/clientmodel/ClientMethod.java index c9da605b8e..05deb89278 100644 --- a/javagen/src/main/java/com/azure/autorest/model/clientmodel/ClientMethod.java +++ b/javagen/src/main/java/com/azure/autorest/model/clientmodel/ClientMethod.java @@ -287,6 +287,17 @@ public void addImportsTo(Set imports, boolean includeImplementationImpor if (settings.isContextClientMethodParameter()) { imports.add("com.azure.core.util.Context"); } + + // Paging + if (getMethodPageDetails() != null) { + imports.add("com.azure.core.http.rest.PagedResponseBase"); + imports.add("com.azure.core.http.rest.PagedResponse"); + imports.add("com.azure.core.http.rest.PagedFlux"); + imports.add("com.azure.core.http.rest.PagedIterable"); + imports.add("java.util.List"); + imports.add("java.util.Map"); + imports.add("java.util.stream.Collectors"); + } } else { getReturnValue().addImportsTo(imports, includeImplementationImports); diff --git a/javagen/src/main/java/com/azure/autorest/model/clientmodel/MethodPageDetails.java b/javagen/src/main/java/com/azure/autorest/model/clientmodel/MethodPageDetails.java index 6bde77457d..f6574dc637 100644 --- a/javagen/src/main/java/com/azure/autorest/model/clientmodel/MethodPageDetails.java +++ b/javagen/src/main/java/com/azure/autorest/model/clientmodel/MethodPageDetails.java @@ -12,28 +12,47 @@ public class MethodPageDetails { * Get whether or not this method is a request to get the next page of a sequence of pages. */ private String nextLinkName; + /** + * Raw nextLink name. It is the name in swagger and in response. + */ + private String rawNextLinkName; private String itemName; + /** + * Raw item name. It is the name in swagger and in response. + */ + private String rawItemName; private ClientMethod nextMethod; // Proxy method return type is Flux. Client method return type is PagedResponse<>. // This intermediate type is the type of pagination response (the type with values and nextLink). private IType lroIntermediateType; - public MethodPageDetails(String nextLinkName, String itemName, ClientMethod nextMethod, IType lroIntermediateType) { + public MethodPageDetails(String nextLinkName, String itemName, ClientMethod nextMethod, IType lroIntermediateType, + String rawNextLinkName, String rawItemName) { this.nextLinkName = nextLinkName; this.itemName = itemName; this.nextMethod = nextMethod; this.lroIntermediateType = lroIntermediateType; + this.rawNextLinkName = rawNextLinkName; + this.rawItemName = rawItemName; } public String getNextLinkName() { return nextLinkName; } + public String getRawNextLinkName() { + return rawNextLinkName; + } + public String getItemName() { return itemName; } + public String getRawItemName() { + return rawItemName; + } + public ClientMethod getNextMethod() { return nextMethod; } diff --git a/javagen/src/main/java/com/azure/autorest/template/ClientMethodTemplate.java b/javagen/src/main/java/com/azure/autorest/template/ClientMethodTemplate.java index d9b6407738..f68ad254d9 100644 --- a/javagen/src/main/java/com/azure/autorest/template/ClientMethodTemplate.java +++ b/javagen/src/main/java/com/azure/autorest/template/ClientMethodTemplate.java @@ -335,20 +335,23 @@ public final void write(ClientMethod clientMethod, JavaType typeBlock) { switch (clientMethod.getType()) { case PagingSync: - if (!settings.isLowLevelClient()) { - // TODO: https://github.com/Azure/autorest.java/issues/1034 + if (settings.isLowLevelClient()) { + generateProtocolPagingSync(clientMethod, typeBlock, restAPIMethod, settings); + } else { generatePagingSync(clientMethod, typeBlock, restAPIMethod, settings); } break; case PagingAsync: - if (!settings.isLowLevelClient()) { - // TODO: https://github.com/Azure/autorest.java/issues/1034 + if (settings.isLowLevelClient()) { + generateProtocolPagingAsync(clientMethod, typeBlock, restAPIMethod, settings); + } else { generatePagingAsync(clientMethod, typeBlock, restAPIMethod, settings); } break; case PagingAsyncSinglePage: - if (!settings.isLowLevelClient()) { - // TODO: https://github.com/Azure/autorest.java/issues/1034 + if (settings.isLowLevelClient()) { + generateProtocolPagingAsyncSinglePage(clientMethod, typeBlock, restAPIMethod, settings); + } else { generatePagedAsyncSinglePage(clientMethod, typeBlock, restAPIMethod, settings); } break; @@ -437,6 +440,18 @@ public final void write(ClientMethod clientMethod, JavaType typeBlock) { } } + protected void generateProtocolPagingSync(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod, JavaSettings settings) { + generatePagingSync(clientMethod, typeBlock, restAPIMethod, settings); + } + + protected void generateProtocolPagingAsync(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod, JavaSettings settings) { + generatePagingAsync(clientMethod, typeBlock, restAPIMethod, settings); + } + + protected void generateProtocolPagingAsyncSinglePage(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod, JavaSettings settings) { + generatePagedAsyncSinglePage(clientMethod, typeBlock, restAPIMethod, settings); + } + protected void generatePagingSync(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod, JavaSettings settings) { typeBlock.annotation("ServiceMethod(returns = ReturnType.COLLECTION)"); typeBlock.publicMethod(clientMethod.getDeclaration(), function -> { @@ -762,79 +777,53 @@ private static String parameterDescriptionOrDefault(ProxyMethodParameter paramet protected void generatePagedAsyncSinglePage(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod, JavaSettings settings) { typeBlock.annotation("ServiceMethod(returns = ReturnType.SINGLE)"); - if (clientMethod.getMethodPageDetails().nonNullNextLink()) { - writeMethod(typeBlock, clientMethod.getMethodVisibility(), clientMethod.getDeclaration(), function -> { - AddValidations(function, clientMethod.getRequiredNullableParameterExpressions(), clientMethod.getValidateExpressions(), settings); - AddOptionalAndConstantVariables(function, clientMethod, restAPIMethod.getParameters(), settings); - ApplyParameterTransformations(function, clientMethod, settings); - ConvertClientTypesToWireTypes(function, clientMethod, restAPIMethod.getParameters(), clientMethod.getClientReference(), settings); - - String serviceMethodCall = checkAndReplaceParamNameCollision(clientMethod, restAPIMethod, settings); - if (settings.getAddContextParameter()) { - if (settings.isContextClientMethodParameter() && contextInParameters(clientMethod)) { - function.line(String.format("return %s", serviceMethodCall)); - } else { - function.line(String.format("return FluxUtil.withContext(context -> %s)", - serviceMethodCall)); - } + writeMethod(typeBlock, clientMethod.getMethodVisibility(), clientMethod.getDeclaration(), function -> { + AddValidations(function, clientMethod.getRequiredNullableParameterExpressions(), clientMethod.getValidateExpressions(), settings); + AddOptionalAndConstantVariables(function, clientMethod, restAPIMethod.getParameters(), settings); + ApplyParameterTransformations(function, clientMethod, settings); + ConvertClientTypesToWireTypes(function, clientMethod, restAPIMethod.getParameters(), clientMethod.getClientReference(), settings); + + String serviceMethodCall = checkAndReplaceParamNameCollision(clientMethod, restAPIMethod, settings); + if (settings.getAddContextParameter()) { + if (settings.isContextClientMethodParameter() && contextInParameters(clientMethod)) { + function.line(String.format("return %s", serviceMethodCall)); } else { - function.line(String.format("return %s", - serviceMethodCall)); + function.line(String.format("return FluxUtil.withContext(context -> %s)", + serviceMethodCall)); } + } else { + function.line(String.format("return %s", + serviceMethodCall)); + } + function.indent(() -> { + function.line(".map(res -> new PagedResponseBase<>("); function.indent(() -> { - function.line(".map(res -> new PagedResponseBase<>("); - function.indent(() -> { - function.line("res.getRequest(),"); - function.line("res.getStatusCode(),"); - function.line("res.getHeaders(),"); + function.line("res.getRequest(),"); + function.line("res.getStatusCode(),"); + function.line("res.getHeaders(),"); + if (settings.isLowLevelClient()) { + function.line("getValues(res.getValue(), \"%s\"),", clientMethod.getMethodPageDetails().getRawItemName()); + } else { function.line("res.getValue().%s(),", CodeNamer.getModelNamer().modelPropertyGetterName(clientMethod.getMethodPageDetails().getItemName())); - function.line("res.getValue().%s(),", CodeNamer.getModelNamer().modelPropertyGetterName(clientMethod.getMethodPageDetails().getNextLinkName())); - IType responseType = ((GenericType) clientMethod.getProxyMethod().getReturnType()).getTypeArguments()[0]; - if (responseType instanceof ClassType) { - function.line("res.getDeserializedHeaders()));"); + } + if (clientMethod.getMethodPageDetails().nonNullNextLink()) { + if (settings.isLowLevelClient()) { + function.line("getNextLink(res.getValue(), \"%s\"),", clientMethod.getMethodPageDetails().getRawNextLinkName()); } else { - function.line("null));"); + function.line("res.getValue().%s(),", CodeNamer.getModelNamer().modelPropertyGetterName(clientMethod.getMethodPageDetails().getNextLinkName())); } - }); - }); - }); - } else { - writeMethod(typeBlock, clientMethod.getMethodVisibility(), clientMethod.getDeclaration(), function -> { - AddValidations(function, clientMethod.getRequiredNullableParameterExpressions(), clientMethod.getValidateExpressions(), settings); - AddOptionalAndConstantVariables(function, clientMethod, restAPIMethod.getParameters(), settings); - ApplyParameterTransformations(function, clientMethod, settings); - ConvertClientTypesToWireTypes(function, clientMethod, restAPIMethod.getParameters(), clientMethod.getClientReference(), settings); - - String serviceMethodCall = checkAndReplaceParamNameCollision(clientMethod, restAPIMethod, settings); - if (settings.getAddContextParameter()) { - if (settings.isContextClientMethodParameter() && contextInParameters(clientMethod)) { - function.line(String.format("return %s", serviceMethodCall)); } else { - function.line(String.format("return FluxUtil.withContext(context -> %s)", - serviceMethodCall)); - } - } else { - function.line(String.format("return %s", - serviceMethodCall)); - } - function.indent(() -> { - function.line(".map(res -> new PagedResponseBase<>("); - function.indent(() -> { - function.line("res.getRequest(),"); - function.line("res.getStatusCode(),"); - function.line("res.getHeaders(),"); - function.line("res.getValue().%s(),", CodeNamer.getModelNamer().modelPropertyGetterName(clientMethod.getMethodPageDetails().getItemName())); function.line("null,"); - IType responseType = ((GenericType) clientMethod.getProxyMethod().getReturnType()).getTypeArguments()[0]; - if (responseType instanceof ClassType) { - function.line("res.getDeserializedHeaders()));"); - } else { - function.line("null));"); - } - }); + } + IType responseType = ((GenericType) clientMethod.getProxyMethod().getReturnType()).getTypeArguments()[0]; + if (responseType instanceof ClassType) { + function.line("res.getDeserializedHeaders()));"); + } else { + function.line("null));"); + } }); }); - } + }); } private String checkAndReplaceParamNameCollision(ClientMethod clientMethod, ProxyMethod restAPIMethod, JavaSettings settings) { diff --git a/javagen/src/main/java/com/azure/autorest/template/MethodGroupTemplate.java b/javagen/src/main/java/com/azure/autorest/template/MethodGroupTemplate.java index 45881f643e..5d29f4c39f 100644 --- a/javagen/src/main/java/com/azure/autorest/template/MethodGroupTemplate.java +++ b/javagen/src/main/java/com/azure/autorest/template/MethodGroupTemplate.java @@ -10,15 +10,11 @@ import com.azure.autorest.extension.base.plugin.JavaSettings; import com.azure.autorest.model.clientmodel.IType; import com.azure.autorest.model.clientmodel.MethodGroupClient; -import com.azure.autorest.model.javamodel.JavaBlock; -import com.azure.autorest.model.javamodel.JavaClass; -import com.azure.autorest.model.javamodel.JavaFile; -import com.azure.autorest.model.javamodel.JavaVisibility; +import com.azure.autorest.model.javamodel.*; import com.azure.autorest.util.ClientModelUtil; +import com.azure.core.util.BinaryData; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; /** @@ -93,10 +89,28 @@ public final void write(MethodGroupClient methodGroupClient, JavaFile javaFile) Templates.getClientMethodTemplate().write(clientMethod, classBlock); } + writePagingHelperMethods(methodGroupClient, classBlock); + writeAdditionalClassBlock(classBlock); }); } + protected void writePagingHelperMethods(MethodGroupClient methodGroupClient, JavaClass classBlock) { + classBlock.privateMethod("List getValues(BinaryData binaryData, String path)", block -> { + block.line("try {"); + block.line("Object obj = binaryData.toObject(Object.class);"); + block.line("Object values = ((Map)obj).get(path);"); + block.line("return (List)(((List)values).stream().map(BinaryData::fromObject).collect(Collectors.toList()));"); + block.line("} catch (Exception e) { return null; }"); + }); + classBlock.privateMethod("String getNextLink(BinaryData binaryData, String path)", block -> { + block.line("try {"); + block.line("Object obj = binaryData.toObject(Object.class);"); + block.line("return (String)((Map)obj).getOrDefault(path, null);"); + block.line("} catch (Exception e) { return null; }"); + }); + } + protected void writeAdditionalClassBlock(JavaClass classBlock) { } diff --git a/javagen/src/main/java/com/azure/autorest/template/TemplateFactory.java b/javagen/src/main/java/com/azure/autorest/template/TemplateFactory.java index ecdf4c2171..6ba4ed4119 100644 --- a/javagen/src/main/java/com/azure/autorest/template/TemplateFactory.java +++ b/javagen/src/main/java/com/azure/autorest/template/TemplateFactory.java @@ -54,4 +54,3 @@ public interface TemplateFactory { ModuleInfoTemplate getModuleInfoTemplate(); } - diff --git a/javagen/src/main/java/com/azure/autorest/template/WrapperClientMethodTemplate.java b/javagen/src/main/java/com/azure/autorest/template/WrapperClientMethodTemplate.java index 2680b38517..aa0a1ee47b 100644 --- a/javagen/src/main/java/com/azure/autorest/template/WrapperClientMethodTemplate.java +++ b/javagen/src/main/java/com/azure/autorest/template/WrapperClientMethodTemplate.java @@ -7,6 +7,7 @@ import com.azure.autorest.model.clientmodel.PrimitiveType; import com.azure.autorest.model.clientmodel.ProxyMethod; import com.azure.autorest.model.javamodel.JavaType; + import java.util.List; import java.util.stream.Collectors; @@ -17,74 +18,73 @@ */ public class WrapperClientMethodTemplate implements IJavaTemplate { - private static final WrapperClientMethodTemplate instance = new WrapperClientMethodTemplate(); - private WrapperClientMethodTemplate() { - } - - public static WrapperClientMethodTemplate getInstance() { - return instance; - } - - @Override - public void write(ClientMethod clientMethod, JavaType typeBlock) { - JavaSettings settings = JavaSettings.getInstance(); + private static final WrapperClientMethodTemplate instance = new WrapperClientMethodTemplate(); - ProxyMethod restAPIMethod = clientMethod.getProxyMethod(); - generateJavadoc(clientMethod, typeBlock, restAPIMethod); - - switch (clientMethod.getType()) { - case PagingSync: - case PagingAsync: - case PagingAsyncSinglePage: - return; -// TODO: https://github.com/Azure/autorest.java/issues/1034 -// typeBlock.annotation("ServiceMethod(returns = ReturnType.COLLECTION)"); -// break; - default: - typeBlock.annotation("ServiceMethod(returns = ReturnType.SINGLE)"); - break; + private WrapperClientMethodTemplate() { } - String methodName = clientMethod.getName(); - if (clientMethod.getType().name().contains("Async") && methodName.endsWith("Async")) { - methodName = methodName.substring(0, methodName.length() - "Async".length()); + public static WrapperClientMethodTemplate getInstance() { + return instance; } - String declaration = String.format("%1$s %2$s(%3$s)", clientMethod.getReturnValue().getType(), methodName, clientMethod.getParametersDeclaration()); - typeBlock.publicMethod(declaration, function -> { - boolean shouldReturn = true; - if (clientMethod.getReturnValue() != null && clientMethod.getReturnValue().getType() instanceof PrimitiveType) { - PrimitiveType type = (PrimitiveType) clientMethod.getReturnValue().getType(); - if (type.asNullable() == ClassType.Void) { - shouldReturn = false; + @Override + public void write(ClientMethod clientMethod, JavaType typeBlock) { + JavaSettings settings = JavaSettings.getInstance(); + + ProxyMethod restAPIMethod = clientMethod.getProxyMethod(); + generateJavadoc(clientMethod, typeBlock, restAPIMethod); + + switch (clientMethod.getType()) { + case PagingSync: + case PagingAsync: + typeBlock.annotation("ServiceMethod(returns = ReturnType.COLLECTION)"); + break; + case PagingAsyncSinglePage: + typeBlock.annotation("ServiceMethod(returns = ReturnType.SINGLE)"); + break; + default: + typeBlock.annotation("ServiceMethod(returns = ReturnType.SINGLE)"); + break; } - } - List parameters = clientMethod.getMethodInputParameters(); - function - .line((shouldReturn ? "return " : "" ) + "this.serviceClient.%1$s(%2$s);", clientMethod.getName(), - parameters.stream().map(ClientMethodParameter::getName).collect(Collectors.joining(", "))); - }); - } + String methodName = clientMethod.getName(); + if (clientMethod.getType().name().contains("Async") && methodName.endsWith("Async")) { + methodName = methodName.substring(0, methodName.length() - "Async".length()); + } + String declaration = String.format("%1$s %2$s(%3$s)", clientMethod.getReturnValue().getType(), methodName, clientMethod.getParametersDeclaration()); + typeBlock.publicMethod(declaration, function -> { - protected void generateJavadoc(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod) { - typeBlock.javadocComment(comment -> { - comment.description(clientMethod.getDescription()); - List methodParameters = clientMethod.getMethodInputParameters(); - for (ClientMethodParameter parameter : methodParameters) { - comment.param(parameter.getName(), parameter.getDescription()); - } - if (clientMethod.getParametersDeclaration() != null && !clientMethod.getParametersDeclaration().isEmpty()) { - comment.methodThrows("IllegalArgumentException", "thrown if parameters fail the validation"); - } - if (restAPIMethod.getUnexpectedResponseExceptionType() != null) { - comment.methodThrows(restAPIMethod.getUnexpectedResponseExceptionType().toString(), - "thrown if the request is rejected by server"); - } - comment.methodThrows("RuntimeException", "all other wrapped checked exceptions if the request fails to be sent"); - comment.methodReturns(clientMethod.getReturnValue().getDescription()); - }); - } + boolean shouldReturn = true; + if (clientMethod.getReturnValue() != null && clientMethod.getReturnValue().getType() instanceof PrimitiveType) { + PrimitiveType type = (PrimitiveType) clientMethod.getReturnValue().getType(); + if (type.asNullable() == ClassType.Void) { + shouldReturn = false; + } + } + List parameters = clientMethod.getMethodInputParameters(); + function + .line((shouldReturn ? "return " : "") + "this.serviceClient.%1$s(%2$s);", clientMethod.getName(), + parameters.stream().map(ClientMethodParameter::getName).collect(Collectors.joining(", "))); + }); + } + protected void generateJavadoc(ClientMethod clientMethod, JavaType typeBlock, ProxyMethod restAPIMethod) { + typeBlock.javadocComment(comment -> { + comment.description(clientMethod.getDescription()); + List methodParameters = clientMethod.getMethodInputParameters(); + for (ClientMethodParameter parameter : methodParameters) { + comment.param(parameter.getName(), parameter.getDescription()); + } + if (clientMethod.getParametersDeclaration() != null && !clientMethod.getParametersDeclaration().isEmpty()) { + comment.methodThrows("IllegalArgumentException", "thrown if parameters fail the validation"); + } + if (restAPIMethod.getUnexpectedResponseExceptionType() != null) { + comment.methodThrows(restAPIMethod.getUnexpectedResponseExceptionType().toString(), + "thrown if the request is rejected by server"); + } + comment.methodThrows("RuntimeException", "all other wrapped checked exceptions if the request fails to be sent"); + comment.methodReturns(clientMethod.getReturnValue().getDescription()); + }); + } } diff --git a/javagen/src/main/java/com/azure/autorest/template/protocol/ProtocolAsyncClientTemplate.java b/javagen/src/main/java/com/azure/autorest/template/protocol/ProtocolAsyncClientTemplate.java index d75f608f63..a3f8e5888b 100644 --- a/javagen/src/main/java/com/azure/autorest/template/protocol/ProtocolAsyncClientTemplate.java +++ b/javagen/src/main/java/com/azure/autorest/template/protocol/ProtocolAsyncClientTemplate.java @@ -1,13 +1,16 @@ package com.azure.autorest.template.protocol; +import com.azure.autorest.Javagen; import com.azure.autorest.extension.base.model.codemodel.RequestParameterLocation; import com.azure.autorest.extension.base.plugin.JavaSettings; +import com.azure.autorest.extension.base.plugin.PluginLogger; import com.azure.autorest.model.clientmodel.*; import com.azure.autorest.model.javamodel.JavaFile; import com.azure.autorest.model.javamodel.JavaVisibility; import com.azure.autorest.template.IJavaTemplate; import com.azure.autorest.template.Templates; import com.azure.autorest.util.ClientModelUtil; +import org.slf4j.Logger; import java.util.HashSet; import java.util.List; @@ -19,6 +22,8 @@ */ public class ProtocolAsyncClientTemplate implements IJavaTemplate { + private static final Logger logger = new PluginLogger(Javagen.getPluginInstance(), ProtocolAsyncClientTemplate.class); + private static ProtocolAsyncClientTemplate _instance = new ProtocolAsyncClientTemplate(); private ProtocolAsyncClientTemplate() { } diff --git a/protocol-tests/pom.xml b/protocol-tests/pom.xml index 92008fce08..590509bf33 100644 --- a/protocol-tests/pom.xml +++ b/protocol-tests/pom.xml @@ -44,9 +44,9 @@ test - junit - junit - 4.13.1 + org.junit.jupiter + junit-jupiter-api + 5.7.2 test diff --git a/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceAsyncClient.java b/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceAsyncClient.java new file mode 100644 index 0000000000..aa4122fb44 --- /dev/null +++ b/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceAsyncClient.java @@ -0,0 +1,790 @@ +package fixtures.paging; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.RequestOptions; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.BinaryData; +import fixtures.paging.implementation.PagingsImpl; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous AutoRestPagingTestService type. */ +@ServiceClient(builder = AutoRestPagingTestServiceBuilder.class, isAsync = true) +public final class AutoRestPagingTestServiceAsyncClient { + private final PagingsImpl serviceClient; + + /** + * Initializes an instance of Pagings client. + * + * @param serviceClient the service client implementation. + */ + AutoRestPagingTestServiceAsyncClient(PagingsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * A paging operation that must return result of the default 'value' node. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNoItemNamePagesSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getNoItemNamePagesSinglePageAsync(requestOptions); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getNoItemNamePages(RequestOptions requestOptions) { + return this.serviceClient.getNoItemNamePagesAsync(requestOptions); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullNextLinkNamePagesSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getNullNextLinkNamePagesSinglePageAsync(requestOptions); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getNullNextLinkNamePages(RequestOptions requestOptions) { + return this.serviceClient.getNullNextLinkNamePagesAsync(requestOptions); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesSinglePageAsync(requestOptions); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getSinglePages(RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesAsync(requestOptions); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstResponseEmptySinglePage(RequestOptions requestOptions) { + return this.serviceClient.firstResponseEmptySinglePageAsync(requestOptions); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux firstResponseEmpty(RequestOptions requestOptions) { + return this.serviceClient.firstResponseEmptyAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesSinglePageAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePages(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesAsync(requestOptions); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithQueryParamsSinglePage( + int requiredQueryParameter, RequestOptions requestOptions) { + return this.serviceClient.getWithQueryParamsSinglePageAsync(requiredQueryParameter, requestOptions); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getWithQueryParams(int requiredQueryParameter, RequestOptions requestOptions) { + return this.serviceClient.getWithQueryParamsAsync(requiredQueryParameter, requestOptions); + } + + /** + * Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextOperationWithQueryParamsSinglePage(RequestOptions requestOptions) { + return this.serviceClient.nextOperationWithQueryParamsSinglePageAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOdataMultiplePagesSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getOdataMultiplePagesSinglePageAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getOdataMultiplePages(RequestOptions requestOptions) { + return this.serviceClient.getOdataMultiplePagesAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param offset Offset of return value. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesWithOffsetSinglePage( + int offset, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesWithOffsetSinglePageAsync(offset, requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param offset Offset of return value. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesWithOffset(int offset, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesWithOffsetAsync(offset, requestOptions); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetryFirstSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetryFirstSinglePageAsync(requestOptions); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesRetryFirst(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetryFirstAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetrySecondSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetrySecondSinglePageAsync(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesRetrySecond(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetrySecondAsync(requestOptions); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesFailureSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesFailureSinglePageAsync(requestOptions); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getSinglePagesFailure(RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesFailureAsync(requestOptions); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureSinglePageAsync(requestOptions); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFailure(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureAsync(requestOptions); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureUriSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureUriSinglePageAsync(requestOptions); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFailureUri(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureUriAsync(requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFragmentNextLinkSinglePage( + String apiVersion, String tenant, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFragmentNextLinkSinglePageAsync(apiVersion, tenant, requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFragmentNextLink( + String apiVersion, String tenant, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFragmentNextLinkAsync(apiVersion, tenant, requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFragmentWithGroupingNextLinkSinglePage( + String apiVersion, String tenant, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync( + apiVersion, tenant, requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFragmentWithGroupingNextLink( + String apiVersion, String tenant, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFragmentWithGroupingNextLinkAsync(apiVersion, tenant, requestOptions); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesLROSinglePage(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesLROSinglePageAsync(requestOptions); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesLRO(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesLROAsync(requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param nextLink Next link for list operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextFragmentSinglePage( + String apiVersion, String tenant, String nextLink, RequestOptions requestOptions) { + return this.serviceClient.nextFragmentSinglePageAsync(apiVersion, tenant, nextLink, requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param nextLink Next link for list operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextFragmentWithGroupingSinglePage( + String apiVersion, String tenant, String nextLink, RequestOptions requestOptions) { + return this.serviceClient.nextFragmentWithGroupingSinglePageAsync(apiVersion, tenant, nextLink, requestOptions); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPagingModelWithItemNameWithXMSClientNameSinglePage( + RequestOptions requestOptions) { + return this.serviceClient.getPagingModelWithItemNameWithXMSClientNameSinglePageAsync(requestOptions); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getPagingModelWithItemNameWithXMSClientName(RequestOptions requestOptions) { + return this.serviceClient.getPagingModelWithItemNameWithXMSClientNameAsync(requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNoItemNamePagesNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getNoItemNamePagesNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstResponseEmptyNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.firstResponseEmptyNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOdataMultiplePagesNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getOdataMultiplePagesNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesWithOffsetNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesWithOffsetNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetryFirstNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetryFirstNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetrySecondNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetrySecondNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesFailureNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesFailureNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureUriNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureUriNextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesLRONextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesLRONextSinglePageAsync(nextLink, requestOptions); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPagingModelWithItemNameWithXMSClientNameNextSinglePage( + String nextLink, RequestOptions requestOptions) { + return this.serviceClient.getPagingModelWithItemNameWithXMSClientNameNextSinglePageAsync( + nextLink, requestOptions); + } +} diff --git a/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceBuilder.java b/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceBuilder.java new file mode 100644 index 0000000000..4ffe1778f6 --- /dev/null +++ b/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceBuilder.java @@ -0,0 +1,229 @@ +package fixtures.paging; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.Configuration; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import fixtures.paging.implementation.AutoRestPagingTestServiceImpl; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** A builder for creating a new instance of the AutoRestPagingTestService type. */ +@ServiceClientBuilder( + serviceClients = {AutoRestPagingTestServiceClient.class, AutoRestPagingTestServiceAsyncClient.class}) +public final class AutoRestPagingTestServiceBuilder { + private static final String SDK_NAME = "name"; + + private static final String SDK_VERSION = "version"; + + private final Map properties = new HashMap<>(); + + /** Create an instance of the AutoRestPagingTestServiceBuilder. */ + public AutoRestPagingTestServiceBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * server parameter + */ + private String host; + + /** + * Sets server parameter. + * + * @param host the host value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder host(String host) { + this.host = host; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /* + * The HTTP client used to send the request. + */ + private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + private final List pipelinePolicies; + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the AutoRestPagingTestServiceBuilder. + */ + public AutoRestPagingTestServiceBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of AutoRestPagingTestServiceImpl with the provided parameters. + * + * @return an instance of AutoRestPagingTestServiceImpl. + */ + private AutoRestPagingTestServiceImpl buildInnerClient() { + if (host == null) { + this.host = "http://localhost:3000"; + } + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + if (serializerAdapter == null) { + this.serializerAdapter = JacksonAdapter.createDefaultSerializerAdapter(); + } + AutoRestPagingTestServiceImpl client = new AutoRestPagingTestServiceImpl(pipeline, serializerAdapter, host); + return client; + } + + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + policies.add( + new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll(this.pipelinePolicies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AutoRestPagingTestServiceAsyncClient async client. + * + * @return an instance of AutoRestPagingTestServiceAsyncClient. + */ + public AutoRestPagingTestServiceAsyncClient buildAsyncClient() { + return new AutoRestPagingTestServiceAsyncClient(buildInnerClient().getPagings()); + } + + /** + * Builds an instance of AutoRestPagingTestServiceClient sync client. + * + * @return an instance of AutoRestPagingTestServiceClient. + */ + public AutoRestPagingTestServiceClient buildClient() { + return new AutoRestPagingTestServiceClient(buildInnerClient().getPagings()); + } +} diff --git a/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceClient.java b/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceClient.java new file mode 100644 index 0000000000..01169ba76d --- /dev/null +++ b/protocol-tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceClient.java @@ -0,0 +1,547 @@ +package fixtures.paging; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.RequestOptions; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import fixtures.paging.implementation.PagingsImpl; + +/** Initializes a new instance of the synchronous AutoRestPagingTestService type. */ +@ServiceClient(builder = AutoRestPagingTestServiceBuilder.class) +public final class AutoRestPagingTestServiceClient { + private final PagingsImpl serviceClient; + + /** + * Initializes an instance of Pagings client. + * + * @param serviceClient the service client implementation. + */ + AutoRestPagingTestServiceClient(PagingsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * A paging operation that must return result of the default 'value' node. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNoItemNamePages(RequestOptions requestOptions) { + return this.serviceClient.getNoItemNamePages(requestOptions); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNoItemNamePages(RequestOptions requestOptions, Context context) { + return this.serviceClient.getNoItemNamePages(requestOptions, context); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNullNextLinkNamePages(RequestOptions requestOptions) { + return this.serviceClient.getNullNextLinkNamePages(requestOptions); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNullNextLinkNamePages(RequestOptions requestOptions, Context context) { + return this.serviceClient.getNullNextLinkNamePages(requestOptions, context); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePages(RequestOptions requestOptions) { + return this.serviceClient.getSinglePages(requestOptions); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePages(RequestOptions requestOptions, Context context) { + return this.serviceClient.getSinglePages(requestOptions, context); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable firstResponseEmpty(RequestOptions requestOptions) { + return this.serviceClient.firstResponseEmpty(requestOptions); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable firstResponseEmpty(RequestOptions requestOptions, Context context) { + return this.serviceClient.firstResponseEmpty(requestOptions, context); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePages(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePages(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePages(RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePages(requestOptions, context); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getWithQueryParams(int requiredQueryParameter, RequestOptions requestOptions) { + return this.serviceClient.getWithQueryParams(requiredQueryParameter, requestOptions); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getWithQueryParams( + int requiredQueryParameter, RequestOptions requestOptions, Context context) { + return this.serviceClient.getWithQueryParams(requiredQueryParameter, requestOptions, context); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getOdataMultiplePages(RequestOptions requestOptions) { + return this.serviceClient.getOdataMultiplePages(requestOptions); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getOdataMultiplePages(RequestOptions requestOptions, Context context) { + return this.serviceClient.getOdataMultiplePages(requestOptions, context); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param offset Offset of return value. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesWithOffset(int offset, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesWithOffset(offset, requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param offset Offset of return value. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesWithOffset( + int offset, RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesWithOffset(offset, requestOptions, context); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetryFirst(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetryFirst(requestOptions); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetryFirst(RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesRetryFirst(requestOptions, context); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetrySecond(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesRetrySecond(requestOptions); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetrySecond(RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesRetrySecond(requestOptions, context); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePagesFailure(RequestOptions requestOptions) { + return this.serviceClient.getSinglePagesFailure(requestOptions); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePagesFailure(RequestOptions requestOptions, Context context) { + return this.serviceClient.getSinglePagesFailure(requestOptions, context); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailure(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailure(requestOptions); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailure(RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesFailure(requestOptions, context); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailureUri(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFailureUri(requestOptions); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailureUri(RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesFailureUri(requestOptions, context); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentNextLink( + String apiVersion, String tenant, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFragmentNextLink(apiVersion, tenant, requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentNextLink( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesFragmentNextLink(apiVersion, tenant, requestOptions, context); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentWithGroupingNextLink( + String apiVersion, String tenant, RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesFragmentWithGroupingNextLink(apiVersion, tenant, requestOptions); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentWithGroupingNextLink( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesFragmentWithGroupingNextLink( + apiVersion, tenant, requestOptions, context); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesLRO(RequestOptions requestOptions) { + return this.serviceClient.getMultiplePagesLRO(requestOptions); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesLRO(RequestOptions requestOptions, Context context) { + return this.serviceClient.getMultiplePagesLRO(requestOptions, context); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getPagingModelWithItemNameWithXMSClientName(RequestOptions requestOptions) { + return this.serviceClient.getPagingModelWithItemNameWithXMSClientName(requestOptions); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getPagingModelWithItemNameWithXMSClientName( + RequestOptions requestOptions, Context context) { + return this.serviceClient.getPagingModelWithItemNameWithXMSClientName(requestOptions, context); + } +} diff --git a/protocol-tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java b/protocol-tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java new file mode 100644 index 0000000000..0febcfe03b --- /dev/null +++ b/protocol-tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java @@ -0,0 +1,98 @@ +package fixtures.paging.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** Initializes a new instance of the AutoRestPagingTestService type. */ +public final class AutoRestPagingTestServiceImpl { + /** server parameter. */ + private final String host; + + /** + * Gets server parameter. + * + * @return the host value. + */ + public String getHost() { + return this.host; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The PagingsImpl object to access its operations. */ + private final PagingsImpl pagings; + + /** + * Gets the PagingsImpl object to access its operations. + * + * @return the PagingsImpl object. + */ + public PagingsImpl getPagings() { + return this.pagings; + } + + /** + * Initializes an instance of AutoRestPagingTestService client. + * + * @param host server parameter. + */ + public AutoRestPagingTestServiceImpl(String host) { + this( + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(), + JacksonAdapter.createDefaultSerializerAdapter(), + host); + } + + /** + * Initializes an instance of AutoRestPagingTestService client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param host server parameter. + */ + public AutoRestPagingTestServiceImpl(HttpPipeline httpPipeline, String host) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), host); + } + + /** + * Initializes an instance of AutoRestPagingTestService client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param host server parameter. + */ + public AutoRestPagingTestServiceImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String host) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.host = host; + this.pagings = new PagingsImpl(this); + } +} diff --git a/protocol-tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java b/protocol-tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java new file mode 100644 index 0000000000..44f16f7ed4 --- /dev/null +++ b/protocol-tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java @@ -0,0 +1,3486 @@ +package fixtures.paging.implementation; + +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.RequestOptions; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Pagings. */ +public final class PagingsImpl { + /** The proxy service used to perform REST calls. */ + private final PagingsService service; + + /** The service client containing this operation class. */ + private final AutoRestPagingTestServiceImpl client; + + /** + * Initializes an instance of PagingsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PagingsImpl(AutoRestPagingTestServiceImpl client) { + this.service = RestProxy.create(PagingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AutoRestPagingTestServicePagings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AutoRestPagingTestSe") + private interface PagingsService { + @Get("/paging/noitemname") + Mono> getNoItemNamePages( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/nullnextlink") + Mono> getNullNextLinkNamePages( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/single") + Mono> getSinglePages( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/firstResponseEmpty/1") + Mono> firstResponseEmpty( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple") + Mono> getMultiplePages( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/getWithQueryParams") + Mono> getWithQueryParams( + @HostParam("$host") String host, + @QueryParam("requiredQueryParameter") int requiredQueryParameter, + @QueryParam("queryConstant") boolean queryConstant, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/nextOperationWithQueryParams") + Mono> nextOperationWithQueryParams( + @HostParam("$host") String host, + @QueryParam("queryConstant") boolean queryConstant, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/odata") + Mono> getOdataMultiplePages( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/withpath/{offset}") + Mono> getMultiplePagesWithOffset( + @HostParam("$host") String host, + @PathParam("offset") int offset, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/retryfirst") + Mono> getMultiplePagesRetryFirst( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/retrysecond") + Mono> getMultiplePagesRetrySecond( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/single/failure") + Mono> getSinglePagesFailure( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/failure") + Mono> getMultiplePagesFailure( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/failureuri") + Mono> getMultiplePagesFailureUri( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/fragment/{tenant}") + Mono> getMultiplePagesFragmentNextLink( + @HostParam("$host") String host, + @QueryParam("api_version") String apiVersion, + @PathParam("tenant") String tenant, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/fragmentwithgrouping/{tenant}") + Mono> getMultiplePagesFragmentWithGroupingNextLink( + @HostParam("$host") String host, + @QueryParam("api_version") String apiVersion, + @PathParam("tenant") String tenant, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Post("/paging/multiple/lro") + Mono> getMultiplePagesLRO( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/fragment/{tenant}/{nextLink}") + Mono> nextFragment( + @HostParam("$host") String host, + @QueryParam("api_version") String apiVersion, + @PathParam("tenant") String tenant, + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}") + Mono> nextFragmentWithGrouping( + @HostParam("$host") String host, + @QueryParam("api_version") String apiVersion, + @PathParam("tenant") String tenant, + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/paging/itemNameWithXMSClientName") + Mono> getPagingModelWithItemNameWithXMSClientName( + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getNoItemNamePagesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getSinglePagesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> firstResponseEmptyNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getOdataMultiplePagesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesWithOffsetNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesRetryFirstNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesRetrySecondNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getSinglePagesFailureNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesFailureNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesFailureUriNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getMultiplePagesLRONext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + Mono> getPagingModelWithItemNameWithXMSClientNameNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String host, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNoItemNamePagesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getNoItemNamePages(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNoItemNamePagesSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getNoItemNamePages(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getNoItemNamePagesAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getNoItemNamePagesSinglePageAsync(requestOptions), + nextLink -> getNoItemNamePagesNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getNoItemNamePagesAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getNoItemNamePagesSinglePageAsync(requestOptions, context), + nextLink -> getNoItemNamePagesNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNoItemNamePages(RequestOptions requestOptions) { + return new PagedIterable<>(getNoItemNamePagesAsync(requestOptions)); + } + + /** + * A paging operation that must return result of the default 'value' node. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNoItemNamePages(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getNoItemNamePagesAsync(requestOptions, context)); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullNextLinkNamePagesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getNullNextLinkNamePages( + this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + null, + null)); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullNextLinkNamePagesSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getNullNextLinkNamePages(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + null, + null)); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getNullNextLinkNamePagesAsync(RequestOptions requestOptions) { + return new PagedFlux<>(() -> getNullNextLinkNamePagesSinglePageAsync(requestOptions)); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getNullNextLinkNamePagesAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>(() -> getNullNextLinkNamePagesSinglePageAsync(requestOptions, context)); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNullNextLinkNamePages(RequestOptions requestOptions) { + return new PagedIterable<>(getNullNextLinkNamePagesAsync(requestOptions)); + } + + /** + * A paging operation that must ignore any kind of nextLink, and stop after page 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getNullNextLinkNamePages(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getNullNextLinkNamePagesAsync(requestOptions, context)); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getSinglePages(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getSinglePages(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getSinglePagesAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getSinglePagesSinglePageAsync(requestOptions), + nextLink -> getSinglePagesNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getSinglePagesAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getSinglePagesSinglePageAsync(requestOptions, context), + nextLink -> getSinglePagesNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePages(RequestOptions requestOptions) { + return new PagedIterable<>(getSinglePagesAsync(requestOptions)); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePages(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getSinglePagesAsync(requestOptions, context)); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstResponseEmptySinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.firstResponseEmpty(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstResponseEmptySinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.firstResponseEmpty(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux firstResponseEmptyAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> firstResponseEmptySinglePageAsync(requestOptions), + nextLink -> firstResponseEmptyNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux firstResponseEmptyAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> firstResponseEmptySinglePageAsync(requestOptions, context), + nextLink -> firstResponseEmptyNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable firstResponseEmpty(RequestOptions requestOptions) { + return new PagedIterable<>(firstResponseEmptyAsync(requestOptions)); + } + + /** + * A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) + * call, will give you an items list of 1. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable firstResponseEmpty(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(firstResponseEmptyAsync(requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getMultiplePages(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePages(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesSinglePageAsync(requestOptions), + nextLink -> getMultiplePagesNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesSinglePageAsync(requestOptions, context), + nextLink -> getMultiplePagesNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePages(RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesAsync(requestOptions)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePages(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesAsync(requestOptions, context)); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithQueryParamsSinglePageAsync( + int requiredQueryParameter, RequestOptions requestOptions) { + final boolean queryConstant = true; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getWithQueryParams( + this.client.getHost(), + requiredQueryParameter, + queryConstant, + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithQueryParamsSinglePageAsync( + int requiredQueryParameter, RequestOptions requestOptions, Context context) { + final boolean queryConstant = true; + final String accept = "application/json"; + return service.getWithQueryParams( + this.client.getHost(), requiredQueryParameter, queryConstant, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getWithQueryParamsAsync(int requiredQueryParameter, RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getWithQueryParamsSinglePageAsync(requiredQueryParameter, requestOptions), + nextLink -> nextOperationWithQueryParamsSinglePageAsync(requestOptions)); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getWithQueryParamsAsync( + int requiredQueryParameter, RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getWithQueryParamsSinglePageAsync(requiredQueryParameter, requestOptions, context), + nextLink -> nextOperationWithQueryParamsSinglePageAsync(requestOptions, context)); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getWithQueryParams(int requiredQueryParameter, RequestOptions requestOptions) { + return new PagedIterable<>(getWithQueryParamsAsync(requiredQueryParameter, requestOptions)); + } + + /** + * A paging operation that includes a next operation. It has a different query parameter from it's next operation + * nextOperationWithQueryParams. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param requiredQueryParameter A required integer query parameter. Put in value '100' to pass test. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getWithQueryParams( + int requiredQueryParameter, RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getWithQueryParamsAsync(requiredQueryParameter, requestOptions, context)); + } + + /** + * Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextOperationWithQueryParamsSinglePageAsync(RequestOptions requestOptions) { + final boolean queryConstant = true; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.nextOperationWithQueryParams( + this.client.getHost(), queryConstant, accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + null, + null)); + } + + /** + * Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextOperationWithQueryParamsSinglePageAsync( + RequestOptions requestOptions, Context context) { + final boolean queryConstant = true; + final String accept = "application/json"; + return service.nextOperationWithQueryParams( + this.client.getHost(), queryConstant, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + null, + null)); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOdataMultiplePagesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getOdataMultiplePages(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOdataMultiplePagesSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getOdataMultiplePages(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getOdataMultiplePagesAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getOdataMultiplePagesSinglePageAsync(requestOptions), + nextLink -> getOdataMultiplePagesNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getOdataMultiplePagesAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getOdataMultiplePagesSinglePageAsync(requestOptions, context), + nextLink -> getOdataMultiplePagesNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getOdataMultiplePages(RequestOptions requestOptions) { + return new PagedIterable<>(getOdataMultiplePagesAsync(requestOptions)); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getOdataMultiplePages(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getOdataMultiplePagesAsync(requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param offset Offset of return value. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesWithOffsetSinglePageAsync( + int offset, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesWithOffset( + this.client.getHost(), offset, accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param offset Offset of return value. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesWithOffsetSinglePageAsync( + int offset, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesWithOffset(this.client.getHost(), offset, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param offset Offset of return value. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesWithOffsetAsync(int offset, RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesWithOffsetSinglePageAsync(offset, requestOptions), + nextLink -> getMultiplePagesWithOffsetNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param offset Offset of return value. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesWithOffsetAsync( + int offset, RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesWithOffsetSinglePageAsync(offset, requestOptions, context), + nextLink -> getMultiplePagesWithOffsetNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param offset Offset of return value. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesWithOffset(int offset, RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesWithOffsetAsync(offset, requestOptions)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param offset Offset of return value. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesWithOffset( + int offset, RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesWithOffsetAsync(offset, requestOptions, context)); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetryFirstSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesRetryFirst( + this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetryFirstSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesRetryFirst(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesRetryFirstAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesRetryFirstSinglePageAsync(requestOptions), + nextLink -> getMultiplePagesRetryFirstNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesRetryFirstAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesRetryFirstSinglePageAsync(requestOptions, context), + nextLink -> getMultiplePagesRetryFirstNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetryFirst(RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesRetryFirstAsync(requestOptions)); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a + * nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetryFirst(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesRetryFirstAsync(requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetrySecondSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesRetrySecond( + this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetrySecondSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesRetrySecond(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesRetrySecondAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesRetrySecondSinglePageAsync(requestOptions), + nextLink -> getMultiplePagesRetrySecondNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesRetrySecondAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesRetrySecondSinglePageAsync(requestOptions, context), + nextLink -> getMultiplePagesRetrySecondNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetrySecond(RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesRetrySecondAsync(requestOptions)); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The + * client should retry and finish all 10 pages eventually. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesRetrySecond(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesRetrySecondAsync(requestOptions, context)); + } + + /** + * A paging operation that receives a 400 on the first call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesFailureSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getSinglePagesFailure(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that receives a 400 on the first call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesFailureSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getSinglePagesFailure(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that receives a 400 on the first call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getSinglePagesFailureAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getSinglePagesFailureSinglePageAsync(requestOptions), + nextLink -> getSinglePagesFailureNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that receives a 400 on the first call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getSinglePagesFailureAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getSinglePagesFailureSinglePageAsync(requestOptions, context), + nextLink -> getSinglePagesFailureNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that receives a 400 on the first call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePagesFailure(RequestOptions requestOptions) { + return new PagedIterable<>(getSinglePagesFailureAsync(requestOptions)); + } + + /** + * A paging operation that receives a 400 on the first call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSinglePagesFailure(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getSinglePagesFailureAsync(requestOptions, context)); + } + + /** + * A paging operation that receives a 400 on the second call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesFailure(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that receives a 400 on the second call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesFailure(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that receives a 400 on the second call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFailureAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesFailureSinglePageAsync(requestOptions), + nextLink -> getMultiplePagesFailureNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that receives a 400 on the second call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFailureAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesFailureSinglePageAsync(requestOptions, context), + nextLink -> getMultiplePagesFailureNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that receives a 400 on the second call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailure(RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesFailureAsync(requestOptions)); + } + + /** + * A paging operation that receives a 400 on the second call. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailure(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesFailureAsync(requestOptions, context)); + } + + /** + * A paging operation that receives an invalid nextLink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureUriSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesFailureUri( + this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that receives an invalid nextLink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureUriSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesFailureUri(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that receives an invalid nextLink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFailureUriAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesFailureUriSinglePageAsync(requestOptions), + nextLink -> getMultiplePagesFailureUriNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that receives an invalid nextLink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFailureUriAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesFailureUriSinglePageAsync(requestOptions, context), + nextLink -> getMultiplePagesFailureUriNextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A paging operation that receives an invalid nextLink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailureUri(RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesFailureUriAsync(requestOptions)); + } + + /** + * A paging operation that receives an invalid nextLink. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFailureUri(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesFailureUriAsync(requestOptions, context)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFragmentNextLinkSinglePageAsync( + String apiVersion, String tenant, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesFragmentNextLink( + this.client.getHost(), apiVersion, tenant, accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFragmentNextLinkSinglePageAsync( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesFragmentNextLink( + this.client.getHost(), apiVersion, tenant, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFragmentNextLinkAsync( + String apiVersion, String tenant, RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesFragmentNextLinkSinglePageAsync(apiVersion, tenant, requestOptions), + nextLink -> nextFragmentSinglePageAsync(apiVersion, tenant, nextLink, requestOptions)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFragmentNextLinkAsync( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesFragmentNextLinkSinglePageAsync(apiVersion, tenant, requestOptions, context), + nextLink -> nextFragmentSinglePageAsync(apiVersion, tenant, nextLink, requestOptions, context)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentNextLink( + String apiVersion, String tenant, RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesFragmentNextLinkAsync(apiVersion, tenant, requestOptions)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentNextLink( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesFragmentNextLinkAsync(apiVersion, tenant, requestOptions, context)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync( + String apiVersion, String tenant, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesFragmentWithGroupingNextLink( + this.client.getHost(), apiVersion, tenant, accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesFragmentWithGroupingNextLink( + this.client.getHost(), apiVersion, tenant, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFragmentWithGroupingNextLinkAsync( + String apiVersion, String tenant, RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync(apiVersion, tenant, requestOptions), + nextLink -> nextFragmentWithGroupingSinglePageAsync(apiVersion, tenant, nextLink, requestOptions)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesFragmentWithGroupingNextLinkAsync( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> + getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync( + apiVersion, tenant, requestOptions, context), + nextLink -> + nextFragmentWithGroupingSinglePageAsync(apiVersion, tenant, nextLink, requestOptions, context)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentWithGroupingNextLink( + String apiVersion, String tenant, RequestOptions requestOptions) { + return new PagedIterable<>( + getMultiplePagesFragmentWithGroupingNextLinkAsync(apiVersion, tenant, requestOptions)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment with parameters grouped. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesFragmentWithGroupingNextLink( + String apiVersion, String tenant, RequestOptions requestOptions, Context context) { + return new PagedIterable<>( + getMultiplePagesFragmentWithGroupingNextLinkAsync(apiVersion, tenant, requestOptions, context)); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesLROSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getMultiplePagesLRO(this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesLROSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesLRO(this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesLROAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getMultiplePagesLROSinglePageAsync(requestOptions), + nextLink -> getMultiplePagesLRONextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getMultiplePagesLROAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getMultiplePagesLROSinglePageAsync(requestOptions, context), + nextLink -> getMultiplePagesLRONextSinglePageAsync(nextLink, requestOptions, context)); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesLRO(RequestOptions requestOptions) { + return new PagedIterable<>(getMultiplePagesLROAsync(requestOptions)); + } + + /** + * A long-running paging operation that includes a nextLink that has 10 pages. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getMultiplePagesLRO(RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getMultiplePagesLROAsync(requestOptions, context)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param nextLink Next link for list operation. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextFragmentSinglePageAsync( + String apiVersion, String tenant, String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.nextFragment( + this.client.getHost(), + apiVersion, + tenant, + nextLink, + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param nextLink Next link for list operation. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextFragmentSinglePageAsync( + String apiVersion, String tenant, String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.nextFragment( + this.client.getHost(), apiVersion, tenant, nextLink, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param nextLink Next link for list operation. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextFragmentWithGroupingSinglePageAsync( + String apiVersion, String tenant, String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.nextFragmentWithGrouping( + this.client.getHost(), + apiVersion, + tenant, + nextLink, + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that doesn't return a full URL, just a fragment. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param apiVersion Sets the api version to use. + * @param tenant Sets the tenant to use. + * @param nextLink Next link for list operation. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nextFragmentWithGroupingSinglePageAsync( + String apiVersion, String tenant, String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.nextFragmentWithGrouping( + this.client.getHost(), apiVersion, tenant, nextLink, accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPagingModelWithItemNameWithXMSClientNameSinglePageAsync( + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getPagingModelWithItemNameWithXMSClientName( + this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPagingModelWithItemNameWithXMSClientNameSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getPagingModelWithItemNameWithXMSClientName( + this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getPagingModelWithItemNameWithXMSClientNameAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> getPagingModelWithItemNameWithXMSClientNameSinglePageAsync(requestOptions), + nextLink -> getPagingModelWithItemNameWithXMSClientNameNextSinglePageAsync(nextLink, requestOptions)); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getPagingModelWithItemNameWithXMSClientNameAsync( + RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> getPagingModelWithItemNameWithXMSClientNameSinglePageAsync(requestOptions, context), + nextLink -> + getPagingModelWithItemNameWithXMSClientNameNextSinglePageAsync( + nextLink, requestOptions, context)); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getPagingModelWithItemNameWithXMSClientName(RequestOptions requestOptions) { + return new PagedIterable<>(getPagingModelWithItemNameWithXMSClientNameAsync(requestOptions)); + } + + /** + * A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getPagingModelWithItemNameWithXMSClientName( + RequestOptions requestOptions, Context context) { + return new PagedIterable<>(getPagingModelWithItemNameWithXMSClientNameAsync(requestOptions, context)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNoItemNamePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getNoItemNamePagesNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNoItemNamePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getNoItemNamePagesNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getSinglePagesNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getSinglePagesNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstResponseEmptyNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.firstResponseEmptyNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstResponseEmptyNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.firstResponseEmptyNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOdataMultiplePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getOdataMultiplePagesNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOdataMultiplePagesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getOdataMultiplePagesNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "odata.nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesWithOffsetNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesWithOffsetNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesWithOffsetNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesWithOffsetNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetryFirstNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesRetryFirstNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetryFirstNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesRetryFirstNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetrySecondNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesRetrySecondNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesRetrySecondNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesRetrySecondNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesFailureNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getSinglePagesFailureNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSinglePagesFailureNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getSinglePagesFailureNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesFailureNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesFailureNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureUriNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesFailureUriNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesFailureUriNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesFailureUriNext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesLRONextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getMultiplePagesLRONext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultiplePagesLRONextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getMultiplePagesLRONext(nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPagingModelWithItemNameWithXMSClientNameNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getPagingModelWithItemNameWithXMSClientNameNext( + nextLink, this.client.getHost(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + * @param nextLink The nextLink parameter. + * @return a DynamicRequest where customizations can be made before sent to the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPagingModelWithItemNameWithXMSClientNameNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getPagingModelWithItemNameWithXMSClientNameNext( + nextLink, this.client.getHost(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "values"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Object obj = binaryData.toObject(Object.class); + Object values = ((Map) obj).get(path); + return (List) + (((List) values).stream().map(BinaryData::fromObject).collect(Collectors.toList())); + } catch (Exception e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Object obj = binaryData.toObject(Object.class); + return (String) ((Map) obj).getOrDefault(path, null); + } catch (Exception e) { + return null; + } + } +} diff --git a/protocol-tests/src/main/java/fixtures/paging/package-info.java b/protocol-tests/src/main/java/fixtures/paging/package-info.java new file mode 100644 index 0000000000..5574ed4776 --- /dev/null +++ b/protocol-tests/src/main/java/fixtures/paging/package-info.java @@ -0,0 +1,2 @@ +/** Package containing the classes for AutoRestPagingTestService. Long-running Operation for AutoRest. */ +package fixtures.paging; diff --git a/protocol-tests/src/main/java/module-info.java b/protocol-tests/src/main/java/module-info.java index f8ca70f8ef..cded02c5a5 100644 --- a/protocol-tests/src/main/java/module-info.java +++ b/protocol-tests/src/main/java/module-info.java @@ -1,5 +1,5 @@ -module fixtures.bodystring { +module fixtures.paging { requires transitive com.azure.core; - exports fixtures.bodystring; + exports fixtures.paging; } diff --git a/protocol-tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java b/protocol-tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java index 0dde4042d7..ad7cd2eadb 100644 --- a/protocol-tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java +++ b/protocol-tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java @@ -1,9 +1,9 @@ package fixtures.bodystring; import com.azure.core.util.BinaryData; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.json.Json; import javax.json.JsonObject; @@ -15,7 +15,7 @@ public class EnumOperationsTests { private static EnumClient client; private CountDownLatch lock = new CountDownLatch(1); - @BeforeClass + @BeforeAll public static void setup() { client = new AutoRestSwaggerBATServiceBuilder().buildEnumClient(); } @@ -23,7 +23,7 @@ public static void setup() { @Test public void getNotExpandable() throws Exception { String result = client.getNotExpandable(null); - Assert.assertEquals("red color", result); + Assertions.assertEquals("red color", result); } @Test @@ -34,7 +34,7 @@ public void putNotExpandable() throws Exception { @Test public void getReferenced() throws Exception { String actual = client.getReferenced(null); - Assert.assertEquals("red color", actual); + Assertions.assertEquals("red color", actual); } @Test @@ -47,7 +47,7 @@ public void getReferencedConstant() throws Exception { String res = client.getReferencedConstant(null).toString(); JsonReader jsonReader = Json.createReader(new StringReader(res)); JsonObject result = jsonReader.readObject(); - Assert.assertFalse(result.containsKey("ColorConstant")); + Assertions.assertFalse(result.containsKey("ColorConstant")); } @Test diff --git a/protocol-tests/src/test/java/fixtures/bodystring/StringOperationsTests.java b/protocol-tests/src/test/java/fixtures/bodystring/StringOperationsTests.java index b2c8dd436a..ad3055a34b 100644 --- a/protocol-tests/src/test/java/fixtures/bodystring/StringOperationsTests.java +++ b/protocol-tests/src/test/java/fixtures/bodystring/StringOperationsTests.java @@ -3,24 +3,22 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.util.Base64Util; import com.azure.core.util.BinaryData; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; public class StringOperationsTests { private static StringOperationClient client; private static StringOperationAsyncClient asyncClient; private CountDownLatch lock = new CountDownLatch(1); - @BeforeClass + @BeforeAll public static void setup() { client = new AutoRestSwaggerBATServiceBuilder().buildStringOperationClient(); asyncClient = new AutoRestSwaggerBATServiceBuilder().buildStringOperationAsyncClient(); @@ -29,7 +27,7 @@ public static void setup() { @Test public void getNull() throws Exception { String result = client.getNull(null).toObject(String.class); - Assert.assertEquals(null, result); + Assertions.assertEquals(null, result); } @Test @@ -37,29 +35,29 @@ public void putNull() throws Exception { try { client.putNull(null); } catch (Exception ex) { - Assert.assertEquals(IllegalArgumentException.class, ex.getClass()); - assertTrue(ex.getMessage().contains("Argument for @BodyParam parameter must be non-null")); + Assertions.assertEquals(IllegalArgumentException.class, ex.getClass()); + Assertions.assertTrue(ex.getMessage().contains("Argument for @BodyParam parameter must be non-null")); } } @Test public void getEmpty() throws Exception { String result = client.getEmpty(null).toObject(String.class); - Assert.assertEquals("", result); + Assertions.assertEquals("", result); } @Test public void putEmpty() throws Exception { - asyncClient.putEmptyWithResponse(null).subscribe(v -> {}, t -> fail(t.getMessage()), + asyncClient.putEmptyWithResponse(null).subscribe(v -> {}, t -> Assertions.fail(t.getMessage()), () -> lock.countDown()); - assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); + Assertions.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); } @Test public void getMbcs() throws Exception { String result = client.getMbcs(null).toObject(String.class); String expected = "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑ\uE7C7ɡ〇〾⿻⺁\uE843䜣\uE864€"; - Assert.assertEquals(expected, result); + Assertions.assertEquals(expected, result); } @Test @@ -70,7 +68,7 @@ public void putMbcs() throws Exception { @Test public void getWhitespace() throws Exception { String result = client.getWhitespace(null).toObject(String.class); - Assert.assertEquals(" Now is the time for all good men to come to the aid of their country ", result); + Assertions.assertEquals(" Now is the time for all good men to come to the aid of their country ", result); } @Test @@ -83,15 +81,15 @@ public void getNotProvided() throws Exception { try { client.getNotProvided(null); } catch (Exception ex) { - Assert.assertEquals(HttpResponseException.class, ex.getClass()); - assertTrue(ex.getMessage().contains("JsonMappingException")); + Assertions.assertEquals(HttpResponseException.class, ex.getClass()); + Assertions.assertTrue(ex.getMessage().contains("JsonMappingException")); } } @Test public void getBase64Encoded() throws Exception { byte[] result = client.getBase64Encoded(null); - Assert.assertEquals("a string that gets encoded with base64", + Assertions.assertEquals("a string that gets encoded with base64", new String(Base64.getDecoder().decode(unquote(new String(result, StandardCharsets.UTF_8))), StandardCharsets.UTF_8)); } @@ -113,14 +111,14 @@ private static String unquote(String string) { @Test public void getBase64UrlEncoded() throws Exception { String result = client.getBase64UrlEncoded(null).toObject(String.class); - Assert.assertEquals("a string that gets encoded with base64url", + Assertions.assertEquals("a string that gets encoded with base64url", new String(Base64Util.decodeURL(result.getBytes(StandardCharsets.UTF_8)))); } @Test public void getNullBase64UrlEncoded() throws Exception { byte[] result = client.getNullBase64UrlEncoded(null).toBytes(); - Assert.assertEquals(0, result.length); + Assertions.assertEquals(0, result.length); } @Test diff --git a/protocol-tests/src/test/java/fixtures/paging/PagingTests.java b/protocol-tests/src/test/java/fixtures/paging/PagingTests.java new file mode 100644 index 0000000000..6dd27a743b --- /dev/null +++ b/protocol-tests/src/test/java/fixtures/paging/PagingTests.java @@ -0,0 +1,158 @@ +package fixtures.paging; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.RequestOptions; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + + +public class PagingTests { + private static AutoRestPagingTestServiceAsyncClient asyncClient; + + private static AutoRestPagingTestServiceClient client; + + @BeforeAll + public static void setup() { + asyncClient = new AutoRestPagingTestServiceBuilder().buildAsyncClient(); + client = new AutoRestPagingTestServiceBuilder().buildClient(); + } + + @Test + public void getSinglePages() { + PagedIterable response = client.getSinglePages(null); + Assertions.assertEquals(1, response.stream().count()); + } + + @Test + public void getMultiplePages() { + PagedIterable response = client.getMultiplePages(null, null); + List list = response.stream().collect(Collectors.toList()); + Assertions.assertEquals(10, list.size()); + } + + @Test + public void getOdataMultiplePages() { + PagedIterable response = client.getOdataMultiplePages(null); + List list = response.stream().collect(Collectors.toList()); + Assertions.assertEquals(10, list.size()); + } + + @Test + public void getMultiplePagesWithOffset() throws Exception { + PagedIterable response = client.getMultiplePagesWithOffset(100, null); + List list = response.stream().collect(Collectors.toList()); + Assertions.assertEquals(10, list.size()); + Assertions.assertEquals("{\"properties\":{\"id\":110,\"name\":\"product\"}}", list.get(list.size() - 1).toString()); + } + + @Test + public void getMultiplePagesAsync() throws Exception { + final CountDownLatch lock = new CountDownLatch(1); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addHeader("client-request-id", "client-id"); + asyncClient.getMultiplePages(requestOptions) + .doOnError(throwable -> Assertions.fail(throwable.getMessage())) + .doOnComplete(lock::countDown) + .blockLast(); + + Assertions.assertTrue(lock.await(10000, TimeUnit.MILLISECONDS)); + } + + @Test + public void getMultiplePagesRetryFirst() throws Exception { + PagedIterable response = client.getMultiplePagesRetryFirst(null); + List list = response.stream().collect(Collectors.toList()); + Assertions.assertEquals(10, list.size()); + } + + @Test + public void getMultiplePagesRetrySecond() throws Exception { + PagedIterable response = client.getMultiplePagesRetrySecond(null); + List list = response.stream().collect(Collectors.toList()); + Assertions.assertEquals(10, list.size()); + } + + @Test + public void getSinglePagesFailure() throws Exception { + try { + PagedIterable response = client.getSinglePagesFailure(null); + List list = response.stream().collect(Collectors.toList()); + Assertions.fail(); + } catch (HttpResponseException ex) { + Assertions.assertNotNull(ex.getResponse()); + } + } + + @Test + public void getMultiplePagesFailure() throws Exception { + try { + List list = client.getMultiplePagesFailure(null).stream().collect(Collectors.toList()); + list.size(); + Assertions.fail(); + } catch (HttpResponseException ex) { + Assertions.assertNotNull(ex.getResponse()); + } + } + + @Test + public void getMultiplePagesFailureUri() { + try { + client.getMultiplePagesFailureUri(null).stream().collect(Collectors.toList()); + Assertions.fail(); + } catch (Exception e) { + Assertions.assertTrue(e instanceof HttpResponseException); + HttpResponseException httpResponseException = (HttpResponseException) e; + Assertions.assertEquals(404, httpResponseException.getResponse().getStatusCode()); + } + } + + @Test + public void getMultiplePagesFragmentNextLink() throws Exception { + PagedIterable response = client.getMultiplePagesFragmentNextLink("1.6", "test_user", null); + Assertions.assertEquals(10, response.stream().count()); + } + + @Test + public void getMultiplePagesFragmentWithGroupingNextLink() throws Exception { + PagedIterable response = client.getMultiplePagesFragmentWithGroupingNextLink("1.6", "test_user", null); + Assertions.assertEquals(10, response.stream().count()); + } + + @Test + public void getNoItemNamePages() { + long count = client.getNoItemNamePages(null).stream().count(); + Assertions.assertEquals(1, count); + } + + @Test + public void getNullNextLinkNamePages() { + long count = client.getNullNextLinkNamePages(null).stream().count(); + Assertions.assertEquals(1, count); + } + + @Test + public void getWithQueryParams() { + long count = client.getWithQueryParams(100, null).stream().count(); + Assertions.assertEquals(2, count); + } + + @Test + public void getPagingModelWithItemNameWithXMSClientName() { + long count = client.getPagingModelWithItemNameWithXMSClientName(null).stream().count(); + Assertions.assertEquals(1, count); + } + + @Test + public void firstResponseEmpty() { + long count = client.firstResponseEmpty(null).stream().count(); + Assertions.assertEquals(1, count); + } +}